/* =============================================================================
   COMMUNITY HUB, CHAT & SUGGESTIONS
   ============================================================================= */

/* =============================================================================
   GENERAL FORM ELEMENTS
   ============================================================================= */

/* Multi-line textareas (modals, forms with large max length) should be resizable */
textarea[maxlength]:not([maxlength="100"]):not([maxlength="50"]):not(.chat-textarea) {
    resize: vertical;
    min-height: 72px; /* ~3 rows */
}

/* =============================================================================
   CHAT HEADER
   ============================================================================= */

.chat-header-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--chat-accent) 0%, #ff9500 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    box-shadow: 0 4px 20px rgba(245,194,17,0.25);
}

.chat-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chat-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.3px;
}

.chat-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #888;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

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

.chat-header-btn {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-header-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    transform: translateY(-1px);
}

/* =============================================================================
   CHAT SETTINGS PANEL
   ============================================================================= */
.chat-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 24px;
    background: rgba(20,20,20,0.95);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    animation: slideDown 0.2s ease;
}

.chat-setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #ccc;
}

/* =============================================================================
   PINNED MESSAGE AREA
   ============================================================================= */

.chat-pinned-area {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: linear-gradient(135deg, rgba(245,194,17,0.08) 0%, rgba(255,152,0,0.05) 100%);
    border-bottom: 1px solid rgba(245,194,17,0.15);
    animation: slideDown 0.25s ease;
}

.pinned-icon {
    font-size: 1.1rem;
}

.pinned-content {
    flex: 1;
    font-size: 0.85rem;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pinned-close {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}

.pinned-close:hover {
    color: #f44336;
    background: rgba(244,67,54,0.1);
}

/* =============================================================================
   NEW MESSAGES INDICATOR
   ============================================================================= */

.chat-new-messages {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--chat-accent) 0%, #ff9500 100%);
    color: #000;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 25px;
    cursor: pointer;
    z-index: 20;
    box-shadow: 0 4px 20px rgba(245,194,17,0.4);
    animation: bounceIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transition: transform 0.2s, box-shadow 0.2s;
}

.chat-new-messages:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 6px 30px rgba(245,194,17,0.5);
}

@keyframes bounceIn {
    0% { transform: translateX(-50%) scale(0.8); opacity: 0; }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* =============================================================================
   MESSAGES CONTAINER
   ============================================================================= */

.chat-messages-v2 {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: linear-gradient(180deg, #0a0a0a 0%, #0d0d0d 100%);
    -webkit-overflow-scrolling: touch;
    transform: translateZ(0);
    backface-visibility: hidden;
    contain: layout style;
    will-change: scroll-position;
}

.chat-messages-v2::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages-v2::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

.chat-messages-v2::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

.chat-messages-v2.compact-mode .chat-message-group {
    gap: 6px;
}

.chat-messages-v2.compact-mode .chat-avatar-v2 {
    width: 28px;
    height: 28px;
}

.chat-messages-v2.compact-mode .chat-text-content {
    font-size: 0.85rem;
}

/* =============================================================================
   CHAT WELCOME SCREEN
   ============================================================================= */

.chat-welcome-v2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 30px;
    text-align: center;
    margin: auto;
}

.welcome-graphic {
    position: relative;
    margin-bottom: 24px;
}

.welcome-circles {
    position: absolute;
    inset: -30px;
}

.welcome-circles .circle {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(245,194,17,0.2);
    animation: circleExpand 3s infinite ease-out;
}

.welcome-circles .c1 {
    width: 80px;
    height: 80px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 0s;
}

.welcome-circles .c2 {
    width: 110px;
    height: 110px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 1s;
}

.welcome-circles .c3 {
    width: 140px;
    height: 140px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 2s;
}

@keyframes circleExpand {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.6; }
    100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

.welcome-graphic > svg {
    position: relative;
    color: var(--chat-accent);
    filter: drop-shadow(0 0 20px rgba(245,194,17,0.3));
}

.chat-welcome-v2 h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.chat-welcome-v2 p {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 30px;
}

.welcome-features {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 25px;
    font-size: 0.8rem;
    color: #888;
}

.feature-icon {
    font-size: 1rem;
}

/* Date Divider */
.chat-date-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    position: relative;
}

.chat-date-divider::before,
.chat-date-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}

.chat-date-divider span {
    padding: 6px 16px;
    background: rgba(30,30,30,0.8);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 15px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* =============================================================================
   MESSAGE GROUPS & STANDALONE MESSAGES
   ============================================================================= */

/* Message Group (legacy - keeping for backwards compatibility) */
.chat-message-group {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    contain: layout style;
}

.chat-group-me {
    flex-direction: row-reverse;
}

/* === STANDALONE MESSAGE (avatar + username on every message) === */
.chat-message-standalone {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    contain: layout style;
}

.chat-standalone-me {
    flex-direction: row-reverse;
}

.chat-standalone-avatar {
    flex-shrink: 0;
    padding-top: 4px;
}

.chat-standalone-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 70%;
    min-width: 0;
    overflow: visible;
}

.chat-standalone-me .chat-standalone-content {
    align-items: flex-end;
}

.chat-standalone-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 4px;
}

.chat-standalone-me .chat-standalone-header {
    flex-direction: row-reverse;
}

/* === END STANDALONE MESSAGE === */

.chat-group-avatar {
    flex-shrink: 0;
    padding-top: 4px;
}

.chat-avatar-v2 {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.1);
    transition: transform 0.2s, border-color 0.2s;
}

.chat-avatar-v2:hover {
    transform: scale(1.1);
    border-color: var(--chat-accent);
}

.chat-group-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 70%;
    min-width: 0;
}

.chat-group-me .chat-group-content {
    align-items: flex-end;
}

.chat-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 4px;
}

.chat-group-me .chat-group-header {
    flex-direction: row-reverse;
}

.chat-username {
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.3px;
}

.chat-time {
    font-size: 0.65rem;
    color: #555;
    font-weight: 500;
}

.chat-inline-time {
    font-size: 0.6rem;
    color: #444;
    margin-left: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.chat-message-item:hover .chat-inline-time {
    opacity: 1;
}

.chat-group-messages {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

/* Message Item - community chat specific */
.chat-messages-v2 .chat-message-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    background: transparent !important;
    border: none !important;
    border-width: 0 !important;
    border-radius: 0;
    padding: 0;
    box-shadow: none !important;
    backdrop-filter: none !important;
    content-visibility: auto;
    contain-intrinsic-size: auto 80px;
    overflow: visible;
}

/* For "my" messages (right-aligned) */
.chat-group-me .chat-message-item {
    align-items: flex-end;
}

/* =============================================================================
   MESSAGE NOTIFICATION HIGHLIGHTS
   ============================================================================= */

.chat-message-item.notification-highlight,
.chat-message-item.highlight-flash {
    background: transparent !important;
}

.chat-message-item.notification-highlight .message-content,
.chat-message-item.highlight-flash .message-content {
    outline: 3px solid var(--accent, #ff9800) !important;
    outline-offset: 2px;
    border-radius: 18px;
    box-shadow: 0 0 30px rgba(255,152,0,0.5) !important;
    animation: chatMessageHighlight 3s ease-out !important;
}

@keyframes chatMessageHighlight {
    0% { box-shadow: 0 0 40px rgba(255,152,0,0.7); outline-color: rgba(255,152,0,1); }
    50% { box-shadow: 0 0 25px rgba(255,152,0,0.5); outline-color: rgba(255,152,0,0.8); }
    100% { box-shadow: 0 0 10px rgba(255,152,0,0.2); outline-color: rgba(255,152,0,0.5); }
}

/* Override global bubble styles on the chat-message-item wrapper - they should only apply to .message-content */
/* Only apply to community chat messages (chat-messages-v2), not floating chat */
.chat-messages-v2 .chat-message-item.bubble-style-glossy,
.chat-messages-v2 .chat-message-item.bubble-style-glass,
.chat-messages-v2 .chat-message-item.bubble-style-gradient,
.chat-messages-v2 .chat-message-item.bubble-style-neon,
.chat-messages-v2 .chat-message-item.bubble-style-modern,
.chat-messages-v2 .chat-message-item.bubble-style-flat {
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    border: none !important;
    border-width: 0 !important;
}

.chat-message-item .message-content {
    background: var(--bubble-color, #2a2a2a);
    padding: 12px 16px;
    border-radius: 18px;
    border-top-left-radius: 6px;
    max-width: 100%;
    cursor: pointer;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
    contain: layout style paint;
    transform: translateZ(0);
}

.chat-group-me .chat-message-item .message-content {
    border-top-left-radius: 18px;
    border-top-right-radius: 6px;
    cursor: default;
}

.chat-message-item .message-content:hover {
    filter: brightness(1.1);
}

/* =============================================================================
   BUBBLE STYLES
   ============================================================================= */

.bubble-style-modern .message-content {
    /* Clean modern look - no extra effects */
}

.bubble-style-flat .message-content {
    /* Flat style - no effects */
}

.bubble-style-glass .message-content {
    background: rgba(255,255,255,0.05) !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.bubble-style-gradient .message-content {
    background: linear-gradient(135deg, var(--bubble-color, #2a2a2a), rgba(0,0,0,0.3)) !important;
}

.bubble-style-neon .message-content {
    background: rgba(0, 0, 0, 0.8) !important;
    border: 2px solid var(--bubble-color, #ffc107) !important;
    border-radius: 18px !important;
    position: relative;
}

/* Neon glow effect using pseudo-element for perfect rounded corners */
.bubble-style-neon .message-content::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 20px;
    background: transparent;
    box-shadow: 
        0 0 10px var(--bubble-color, #ffc107),
        0 0 20px var(--bubble-color, #ffc107),
        0 0 30px color-mix(in srgb, var(--bubble-color, #ffc107) 60%, transparent);
    z-index: -1;
    pointer-events: none;
}

/* All neon bubbles get uniform rounded corners */
.bubble-style-neon .message-content,
.chat-message-standalone .bubble-style-neon .message-content,
.chat-message-group .bubble-style-neon .message-content,
.chat-standalone-me .bubble-style-neon .message-content,
.chat-group-me .bubble-style-neon .message-content {
    border-radius: 18px !important;
}

/* =============================================================================
   MESSAGE CONTENT & MENTIONS
   ============================================================================= */

.chat-text-content {
    font-size: 0.95rem;
    line-height: 1.55;
    color: #f0f0f0;
}

.chat-mention {
    color: var(--chat-accent);
    font-weight: 700;
    background: rgba(245,194,17,0.15);
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.chat-mention:hover {
    background: rgba(245,194,17,0.25);
}

/* =============================================================================
   REPLY & QUOTE BLOCKS
   ============================================================================= */

.chat-reply-block {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    position: relative;
}

.reply-quote-line {
    width: 3px;
    background: var(--chat-accent);
    border-radius: 2px;
    flex-shrink: 0;
}

.reply-quote-text {
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
    line-height: 1.4;
}

/* =============================================================================
   GIF MESSAGES
   ============================================================================= */

.chat-gif {
    max-width: 300px;
    max-height: 200px;
    border-radius: 12px;
    display: block;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.chat-gif:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* Clickable chat images */
.clickable-chat-image {
    cursor: pointer;
}

.clickable-chat-image:hover {
    opacity: 0.9;
}

/* =============================================================================
   UPLOADED IMAGES
   ============================================================================= */

.chat-image-container {
    margin-top: 8px;
}

.chat-uploaded-image {
    max-width: 400px;
    max-height: 300px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
}

.chat-uploaded-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* Uploaded Images in Suggestions */
.suggestion-image-container {
    margin: 12px 0;
}

.suggestion-uploaded-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: block;
}

.suggestion-uploaded-image:hover {
    transform: scale(1.01);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* Image Preview before sending */
.image-preview-container {
    position: relative;
    display: inline-block;
    margin: 10px 0;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
}

.image-preview-img {
    max-width: 200px;
    max-height: 150px;
    border-radius: 8px;
    display: block;
}

.image-preview-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(244,67,54,0.9);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.image-preview-remove:hover {
    background: #f44336;
    transform: scale(1.1);
}

/* =============================================================================
   FULLSCREEN IMAGE MODAL
   ============================================================================= */

.image-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.image-modal-content img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.5);
}

.image-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.image-modal-close:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

/* Open in new tab button for image modal */
.image-modal-open-new {
    position: absolute;
    top: -40px;
    right: 50px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-decoration: none;
}

.image-modal-open-new:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.1);
}

/* =============================================================================
   IMAGE APPROVAL SYSTEM
   ============================================================================= */

.suggestion-image-container.pending-approval {
    position: relative;
}

.suggestion-image-container.pending-approval .suggestion-uploaded-image {
    opacity: 0.7;
}

.image-approval-banner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom, rgba(255, 152, 0, 0.95), rgba(255, 152, 0, 0.8));
    color: #000;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 10;
    border-radius: 8px 8px 0 0;
}

.approval-actions {
    display: flex;
    gap: 8px;
}

.approve-btn, .reject-btn {
    padding: 4px 12px;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.approve-btn {
    background: #4caf50;
    color: #fff;
}

.approve-btn:hover {
    background: #45a049;
    transform: scale(1.05);
}

.reject-btn {
    background: #f44336;
    color: #fff;
}

.reject-btn:hover {
    background: #da190b;
    transform: scale(1.05);
}

/* Pending image placeholder for non-developers */
.suggestion-image-container.pending-approval-hidden {
    margin-top: 10px;
}

.pending-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #666;
    gap: 8px;
}

.pending-image-placeholder svg {
    opacity: 0.5;
}

.pending-image-placeholder span {
    font-size: 0.85rem;
    font-style: italic;
}

/* =============================================================================
   MESSAGE ACTIONS
   ============================================================================= */

.message-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 4px;
    z-index: 5;
    align-items: center;
    flex-shrink: 0;
    overflow: visible;
}

.chat-group-me .message-actions {
    justify-content: flex-start;
    padding-left: 4px;
    padding-right: 0;
}

.chat-group-me .reaction-actions-row {
    flex-direction: row-reverse;
}

.chat-message-item:hover .message-actions {
    opacity: 1;
}

.msg-action-btn {
    width: 32px;
    height: 32px;
    background: rgba(30,30,30,0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.msg-action-btn:hover {
    background: rgba(50,50,50,0.95);
    color: #fff;
    transform: scale(1.1);
    z-index: 10;
}

.msg-action-btn.delete-btn:hover {
    background: rgba(244,67,54,0.2);
    color: #f44336;
    border-color: rgba(244,67,54,0.3);
}

/* =============================================================================
   REACTION BAR
   ============================================================================= */

.chat-message-item .reaction-bar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 4px;
    padding: 0 4px;
}

/* Container for reactions and actions on same row */
.chat-message-item .reaction-actions-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
    overflow: visible;
}

/* Sender's standalone messages - reactions at bottom right corner, actions to the left */
.chat-standalone-me .chat-message-item .reaction-actions-row {
    width: 100%;
    justify-content: flex-end;
}

.chat-standalone-me .chat-message-item .reaction-actions-row .message-actions {
    order: -1;
}

/* Ensure reaction-bar doesn't have extra margin in the row */
.chat-message-item .reaction-actions-row .reaction-bar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 0;
    padding: 0 4px;
}

.chat-message-item .reaction-bar .reaction-pill {
    padding: 2px 8px;
    font-size: 0.8rem;
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    border: none;
}

.chat-message-item .reaction-bar .reaction-pill:hover {
    background: rgba(255,255,255,0.15);
}

.chat-message-item .reaction-bar .reaction-pill.active {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-message-item .reaction-bar .reaction-count {
    font-size: 0.7rem;
}

.chat-group-me .chat-message-item {
    align-items: flex-end;
}

.chat-group-me .chat-message-item .reaction-bar {
    justify-content: flex-end;
}

/* =============================================================================
   TYPING INDICATOR
   ============================================================================= */

.typing-indicator-v2 {
    padding: 0 24px;
    min-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.typing-indicator-v2.active {
    padding: 12px 24px;
    min-height: 44px;
}

.typing-indicator-v2-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeSlideIn 0.3s ease;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.typing-avatars {
    display: flex;
}

.typing-avatar {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #333, #222);
    border: 2px solid #1a1a1a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #888;
    margin-left: -8px;
}

.typing-avatar:first-child {
    margin-left: 0;
}

.typing-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.typing-dots-v2 {
    display: flex;
    gap: 4px;
}

.typing-dots-v2 span {
    width: 6px;
    height: 6px;
    background: var(--chat-accent);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dots-v2 span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots-v2 span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

.typing-text {
    font-size: 0.75rem;
    color: #666;
    font-style: italic;
}

/* =============================================================================
   REPLY PREVIEW
   ============================================================================= */

.chat-reply-preview-v2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: linear-gradient(135deg, rgba(245,194,17,0.06) 0%, rgba(255,152,0,0.04) 100%);
    border-top: 1px solid rgba(245,194,17,0.15);
    animation: slideUp 0.25s ease;
}

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

.reply-preview-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.reply-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.reply-info svg {
    color: var(--chat-accent);
}

.reply-label {
    font-size: 0.7rem;
    color: #666;
}

.reply-username {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--chat-accent);
}

.reply-text {
    font-size: 0.75rem;
    color: #888;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 22px;
}

.reply-cancel {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.reply-cancel:hover {
    background: rgba(244,67,54,0.15);
    color: #f44336;
}

/* =============================================================================
   CHAT INPUT
   ============================================================================= */

.chat-input-v2 {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 24px 16px;
    background: linear-gradient(180deg, rgba(15,15,15,0.98) 0%, rgba(10,10,10,0.99) 100%);
    border-top: 1px solid rgba(255,255,255,0.04);
    position: relative;
}

.chat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.chat-auth-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10,10,10,0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
}

.chat-auth-overlay svg {
    color: var(--chat-accent);
}

.chat-auth-overlay span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #888;
}

.input-toolbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 15;
}

.toolbar-btn {
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.toolbar-btn svg {
    pointer-events: none;
}

.toolbar-btn:hover {
    background: rgba(245,194,17,0.1);
    border-color: rgba(245,194,17,0.2);
    color: var(--chat-accent);
    transform: translateY(-1px);
}

/* iOS-Style Emoji Font Stack */
.emoji-picker-v2,
.emoji-item,
.emoji-cat,
.chat-message-text,
.message-content,
.chat-reaction-badge {
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
}

/* =============================================================================
   EMOJI PICKER
   ============================================================================= */

.emoji-picker-v2 {
    position: fixed;
    bottom: 140px;
    left: 24px;
    width: 380px;
    max-width: calc(100vw - 40px);
    max-height: 420px;
    background: var(--bg-dropdown);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 50px rgba(0,0,0,0.9), 0 0 0 1px rgba(255,255,255,0.1);
    z-index: 999999;
    animation: pickerSlideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pickerSlideUp {
    from { opacity: 0; transform: translateY(15px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.emoji-picker-header {
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.emoji-search {
    width: 100%;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.emoji-search:focus {
    border-color: var(--chat-accent);
}

.emoji-search::placeholder {
    color: #555;
}

.emoji-categories {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.emoji-categories::-webkit-scrollbar {
    display: none;
}

.emoji-cat {
    flex-shrink: 0;
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s;
    opacity: 0.5;
}

.emoji-cat:hover {
    background: rgba(255,255,255,0.05);
    opacity: 0.8;
}

.emoji-cat.active {
    background: rgba(245,194,17,0.15);
    opacity: 1;
}

.emoji-grid-v2 {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
    padding: 10px;
    overflow-y: auto;
    max-height: 280px;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.emoji-grid-v2::-webkit-scrollbar {
    width: 6px;
}

.emoji-grid-v2::-webkit-scrollbar-track {
    background: transparent;
}

.emoji-grid-v2::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

.emoji-grid-v2::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

.emoji-item {
    font-size: 1.5rem;
    padding: 5px;
    cursor: pointer;
    border-radius: 8px;
    text-align: center;
    transition: all 0.15s;
    line-height: 1;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* =============================================================================
   GIF PICKER
   ============================================================================= */

.gif-picker {
    position: fixed;
    bottom: 140px;
    left: 24px;
    width: 380px;
    max-width: calc(100vw - 40px);
    max-height: 420px;
    background: var(--bg-dropdown);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 50px rgba(0,0,0,0.9), 0 0 0 1px rgba(255,255,255,0.1);
    z-index: 999999;
    animation: pickerSlideUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.gif-search-wrap {
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.gif-search {
    width: 100%;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.gif-search:focus {
    border-color: var(--chat-accent);
}

.gif-search::placeholder {
    color: #555;
}

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

.gif-item {
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.gif-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.gif-placeholder,
.gif-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #555;
    font-size: 0.85rem;
}

.gif-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255,255,255,0.1);
    border-top-color: var(--chat-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.gif-powered {
    padding: 8px;
    text-align: center;
    font-size: 0.65rem;
    color: #444;
    border-top: 1px solid rgba(255,255,255,0.06);
}

/* =============================================================================
   INPUT WRAPPER & SEND BUTTON
   ============================================================================= */

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.chat-textarea {
    width: 100%;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 14px 55px 14px 20px;
    color: #fff;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    resize: none;
    min-height: 48px;
    max-height: 150px;
    transition: all 0.2s;
    line-height: 1.4;
}

/* Inline Send Button */
.chat-send-inline {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--chat-accent) 0%, #ff9500 100%);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(245,194,17,0.3);
    z-index: 5;
}

.chat-send-inline:hover:not(:disabled) {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 20px rgba(245,194,17,0.5);
}

.chat-send-inline:active:not(:disabled) {
    transform: translateY(-50%) scale(0.95);
}

.chat-send-inline:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.reply-pending {
    opacity: 0.92;
}

.chat-textarea:focus {
    border-color: var(--chat-accent);
    background: rgba(0,0,0,0.6);
    box-shadow: 0 0 0 3px rgba(245,194,17,0.1);
}

.chat-textarea::placeholder {
    color: #555;
}

.chat-textarea:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.input-extras {
    position: absolute;
    bottom: 6px;
    right: 52px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.char-count {
    font-size: 0.65rem;
    color: #444;
    font-weight: 600;
}

/* Send Button V2 */
.chat-send-v2 {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--chat-accent) 0%, #ff9500 100%);
    border: none;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(245,194,17,0.35);
}

.chat-send-v2:hover:not(:disabled) {
    transform: scale(1.08) rotate(-3deg);
    box-shadow: 0 8px 35px rgba(245,194,17,0.5);
}

.chat-send-v2:active:not(:disabled) {
    transform: scale(0.95);
}

.chat-send-v2:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

/* =============================================================================
   LEGACY CHAT INPUT
   ============================================================================= */

#chat-input {
    flex: 1;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.08);
    color: #fff;
    padding: 14px 20px;
    border-radius: 25px;
    font-size: 0.95rem;
    outline: none;
    transition: 0.2s;
    font-family: inherit;
    overflow: hidden;
    resize: none;
}

#chat-input:focus {
    border-color: var(--accent);
    background: rgba(0,0,0,0.7);
    box-shadow: 0 0 0 3px rgba(255,152,0,0.1);
}

#chat-input::placeholder {
    color: #555;
}

.chat-send-btn {
    background: linear-gradient(135deg, var(--accent), #ff8c00);
    color: #000;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    box-shadow: 0 4px 20px rgba(255,152,0,0.3);
}

.chat-send-btn:hover {
    transform: scale(1.08) rotate(-5deg);
    box-shadow: 0 6px 30px rgba(255,152,0,0.5);
}

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

/* Typing Indicator */
.typing-indicator-wrap {
    padding: 8px 24px 0;
    color: #666;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 28px;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: typingPulse 1.2s infinite ease-in-out;
}

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

@keyframes typingPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.1); }
}

/* =============================================================================
   SUGGESTIONS CONTAINER
   ============================================================================= */

.suggestions-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* =============================================================================
   SUGGESTION COMPOSER
   ============================================================================= */

.suggestion-composer {
    background: rgba(0,0,0,0.3);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    overflow: hidden;
}

.composer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: #999;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    background: rgba(255,152,0,0.05);
    border-bottom: 1px solid rgba(255,152,0,0.1);
}

.composer-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.composer-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    margin-right: 8px;
}

.composer-search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 4px 10px;
    transition: all 0.2s ease;
}

.composer-search-box:focus-within {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.4);
}

.composer-search-box svg {
    color: #666;
    flex-shrink: 0;
}

.composer-search-box input {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.8rem;
    width: 140px;
    outline: none;
}

.composer-search-box input::placeholder {
    color: #555;
}

.composer-guidelines-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.composer-guidelines-btn:hover {
    background: rgba(255, 152, 0, 0.1);
    border-color: rgba(255, 152, 0, 0.3);
    color: var(--accent);
}

.composer-guidelines-btn svg {
    width: 14px;
    height: 14px;
}

.composer-header:hover {
    background: rgba(255,152,0,0.1);
    color: #ccc;
}

.composer-header-left svg {
    color: var(--accent);
    width: 16px;
    height: 16px;
}

.composer-header .toggle-icon {
    margin-left: auto;
    transition: transform 0.3s ease;
    color: var(--accent);
    background: rgba(255,152,0,0.15);
    border-radius: 4px;
    padding: 4px;
    width: 20px;
    height: 20px;
}

.suggestion-composer.collapsed .composer-header .toggle-icon {
    transform: rotate(-90deg);
}

.composer-body {
    padding: 12px 16px 14px 16px;
    transition: all 0.3s ease;
    max-height: none;
    opacity: 1;
    overflow: visible;
}

.suggestion-composer.collapsed .composer-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
    overflow: hidden;
}

/* Guidelines Button */
.guidelines-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #888;
    cursor: pointer;
    transition: all 0.2s ease;
}

.guidelines-btn:hover {
    background: rgba(255,152,0,0.15);
    border-color: rgba(255,152,0,0.3);
    color: var(--accent);
}

/* =============================================================================
   FORMATTING TOOLBAR
   ============================================================================= */

.formatting-toolbar {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    margin-bottom: 8px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 1px;
}

.format-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #888;
    cursor: pointer;
    transition: all 0.15s ease;
}

.format-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.1);
    color: #fff;
}

.format-btn:active {
    background: rgba(245,194,17,0.2);
    border-color: rgba(245,194,17,0.3);
    color: var(--accent);
    transform: scale(0.95);
}

.format-btn svg {
    width: 13px;
    height: 13px;
}

.toolbar-divider {
    width: 1px;
    height: 18px;
    background: rgba(255,255,255,0.1);
    margin: 0 4px;
}

.toolbar-help {
    margin-left: auto;
}

.toolbar-help .help-text {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    color: #666;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: help;
    transition: all 0.15s ease;
}

.toolbar-help .help-text:hover {
    background: rgba(255,255,255,0.1);
    color: #999;
}

/* =============================================================================
   COLOR PICKER DROPDOWN
   ============================================================================= */

.color-picker-dropdown {
    position: fixed;
    padding: 10px;
    background: rgba(26,26,26,0.98);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
    display: none;
    z-index: 99999;
}

.color-picker-dropdown.show {
    display: block;
}

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

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
}

.color-swatch:hover {
    transform: scale(1.15);
    border-color: #fff;
}

/* =============================================================================
   FONT PICKER DROPDOWN
   ============================================================================= */

.font-picker-dropdown {
    position: fixed;
    padding: 8px;
    background: rgba(26,26,26,0.98);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
    display: none;
    z-index: 99999;
    min-width: 160px;
    max-height: 300px;
    overflow-y: auto;
}

.font-picker-dropdown.show {
    display: block;
}

.font-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.font-option {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    color: #ccc;
    font-size: 0.85rem;
    transition: all 0.15s ease;
    white-space: nowrap;
}

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

.font-option:active {
    background: rgba(245,194,17,0.2);
    color: var(--accent);
}

/* =============================================================================
   LINK INPUT MODAL
   ============================================================================= */

.link-input-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.link-input-modal.show {
    opacity: 1;
    visibility: visible;
}

.link-input-content {
    background: rgba(30,30,30,0.98);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}

.link-input-content h3 {
    margin: 0 0 16px;
    color: #fff;
    font-size: 1.1rem;
}

.link-input-content input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
    margin-bottom: 12px;
    outline: none;
}

.link-input-content input:focus {
    border-color: var(--accent);
}

.link-input-content input::placeholder {
    color: #666;
}

.link-input-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

.link-input-actions button {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.link-cancel-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: #888;
}

.link-cancel-btn:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.link-confirm-btn {
    background: var(--accent);
    border: none;
    color: #111;
}

.link-confirm-btn:hover {
    background: #e6b30f;
}

/* =============================================================================
   FORMATTED CONTENT RENDERING
   ============================================================================= */

.formatted-content .format-bold {
    font-weight: 700;
}

.formatted-content .format-italic {
    font-style: italic;
}

.formatted-content .format-underline {
    text-decoration: underline;
}

.formatted-content .format-strike {
    text-decoration: line-through;
    opacity: 0.7;
}

.formatted-content .format-heading {
    display: block;
    font-size: 1.2em;
    font-weight: 700;
    margin: 8px 0;
    color: var(--accent);
}

.formatted-content .format-quote {
    display: block;
    padding: 10px 14px;
    margin: 8px 0;
    background: rgba(255,255,255,0.05);
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    color: #aaa;
    font-style: italic;
}

.formatted-content .format-code {
    font-family: 'Consolas', 'Monaco', monospace;
    background: rgba(0,0,0,0.4);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #ff9800;
}

.formatted-content .format-code-block {
    display: block;
    font-family: 'Consolas', 'Monaco', monospace;
    background: rgba(0,0,0,0.5);
    padding: 12px 16px;
    margin: 8px 0;
    border-radius: 8px;
    font-size: 0.9em;
    color: #aaa;
    white-space: pre-wrap;
    overflow-x: auto;
}

.formatted-content .format-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dashed var(--accent);
    transition: all 0.15s ease;
}

.formatted-content .format-link:hover {
    border-bottom-style: solid;
}

.formatted-content .format-spoiler {
    background: var(--border-color);
    color: #333;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.formatted-content .format-spoiler:hover,
.formatted-content .format-spoiler.revealed {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.formatted-content .format-list {
    display: block;
    margin: 8px 0;
    padding-left: 20px;
}

.formatted-content .format-list-item {
    display: list-item;
    margin: 4px 0;
}

.formatted-content ul.format-list {
    list-style-type: disc;
}

.formatted-content ol.format-list {
    list-style-type: decimal;
}

.textarea-wrapper {
    position: relative;
}

.suggestion-textarea {
    width: 100%;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    color: #fff;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 72px; /* Approx 3 rows */
    outline: none;
    transition: 0.2s;
}

.suggestion-textarea:focus {
    border-color: var(--accent);
    background: rgba(0,0,0,0.6);
}

.suggestion-textarea::placeholder {
    color: #555;
}

/* =============================================================================
   SUGGESTION EMOJI PICKER
   ============================================================================= */

.suggestion-emoji-picker {
    position: fixed;
    z-index: 99999;
    width: 432px;
    background: rgba(20,20,20,0.98);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.7);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.suggestion-emoji-grid {
    display: grid;
    grid-template-columns: repeat(10, 36px);
    gap: 4px;
    padding: 16px;
    width: 100%;
    max-height: 340px;
    overflow-y: auto;
    justify-content: center;
    box-sizing: border-box;
}

.suggestion-emoji-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s, transform 0.15s;
}

.suggestion-emoji-item:hover {
    background: rgba(245,194,17,0.25);
    transform: scale(1.15);
}

/* =============================================================================
   REPLY EMOJI PICKER
   ============================================================================= */

.reply-emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    z-index: 100;
}

/* Portal emoji picker (appended to body to avoid clipping) */
.reply-emoji-picker-portal {
    position: fixed;
    z-index: 100001;
}

.reply-emoji-picker-portal .reply-emoji-grid {
    animation: fadeIn 0.15s ease;
}

.reply-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 32px);
    gap: 4px;
    padding: 12px;
    background: var(--bg-dropdown);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    width: 296px; /* 8 * 32px + 7 * 4px + 24px padding */
    justify-content: center;
    box-sizing: border-box;
}

.reply-emoji-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 1.25rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, transform 0.15s;
}

.reply-emoji-item:hover {
    background: rgba(245,194,17,0.2);
    transform: scale(1.15);
}

/* Reply Image Preview Container */
.reply-image-preview-container {
    min-height: 0;
}

.textarea-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.textarea-footer .char-counter {
    color: #555;
    font-size: 0.7rem;
    font-weight: 600;
}

.composer-footer {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    margin-top: 6px;
}

.auth-warning {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #f44336;
    font-size: 0.75rem;
    font-weight: 600;
}

.composer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.char-counter {
    color: #555;
    font-size: 0.7rem;
    font-weight: 600;
}

.post-idea-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--accent), #ff8c00);
    color: #000;
    border: none;
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 10px rgba(255,152,0,0.2);
}

.post-idea-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255,152,0,0.35);
}

.post-idea-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* =============================================================================
   SUGGESTIONS TOOLBAR
   ============================================================================= */

.suggestions-toolbar {
    padding: 14px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    background: rgba(0,0,0,0.2);
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-label {
    color: #666;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 6px;
}

.sort-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #888;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.sort-btn:hover {
    background: rgba(255,255,255,0.03);
    color: #bbb;
}

.sort-btn.active {
    background: rgba(255,152,0,0.1);
    border-color: rgba(255,152,0,0.2);
    color: var(--accent);
}

/* =============================================================================
   ARCHIVED CONTROLS
   ============================================================================= */

.archived-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.archived-sort-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #888;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}

.archived-sort-btn:hover {
    background: rgba(255,255,255,0.03);
    color: #bbb;
}

.archived-sort-btn.active {
    background: rgba(255,152,0,0.1);
    border-color: rgba(255,152,0,0.2);
    color: var(--accent);
}

/* Archived Status Count Badges */
.archived-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #888;
}

.archived-sort-btn.active .archived-count {
    background: rgba(255,152,0,0.2);
    color: var(--accent);
}

/* =============================================================================
   ARCHIVED PAGINATION
   ============================================================================= */

.archived-pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 0;
    margin-top: 16px;
    border-top: 1px solid var(--border-dark);
}

.pagination-info {
    color: #666;
    font-size: 0.8rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: #888;
    padding: 8px 12px;
    min-width: 36px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pagination-btn:hover:not(.disabled) {
    background: rgba(255,255,255,0.1);
    border-color: var(--border-light);
    color: #bbb;
}

.pagination-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

.pagination-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-ellipsis {
    color: #555;
    padding: 0 4px;
}

/* Top pagination has bottom margin, bottom pagination has top margin */
.archived-pagination-top {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-dark);
    border-top: none;
    margin-top: 0;
}

.archived-pagination-bottom {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-dark);
}

/* =============================================================================
   SUGGESTIONS FEED
   ============================================================================= */

.suggestions-feed {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.suggestions-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #444;
}

.suggestions-empty svg {
    opacity: 0.2;
    margin-bottom: 20px;
}

.suggestions-empty h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #555;
    margin-bottom: 8px;
}

.suggestions-empty p {
    font-size: 0.9rem;
    color: #444;
}

/* =============================================================================
   FORUM-STYLE THREAD LIST
   ============================================================================= */

/* Forum Thread Row - Compact uniform rows */
.forum-thread-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(25, 25, 25, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 64px;
    box-sizing: border-box;
}

.forum-thread-row:hover {
    background: rgba(40, 40, 40, 0.95);
    border-color: rgba(255, 152, 0, 0.2);
    transform: translateX(4px);
}

.forum-thread-row.pinned {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.08), rgba(25, 25, 25, 0.95));
    border-color: rgba(255, 152, 0, 0.15);
}

.forum-thread-category {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    flex-shrink: 0;
}

.forum-thread-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.forum-thread-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #e0e0e0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.forum-thread-row:hover .forum-thread-title {
    color: #fff;
}

.forum-thread-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #666;
}

.forum-thread-author {
    color: #888;
    font-weight: 500;
}

.forum-thread-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.forum-thread-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 50px;
}

.forum-thread-stat-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: #aaa;
}

.forum-thread-stat-label {
    font-size: 0.65rem;
    color: #555;
    text-transform: uppercase;
}

.forum-thread-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.forum-thread-time {
    font-size: 0.75rem;
    color: #555;
    min-width: 70px;
    text-align: right;
    flex-shrink: 0;
}

/* Forum Thread Action Buttons */
.forum-thread-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    flex-shrink: 0;
    margin-left: 8px;
}

.forum-thread-row:hover .forum-thread-actions {
    opacity: 1;
}

.forum-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
    color: #999;
}

.forum-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: scale(1.1);
}

.forum-action-btn.forum-delete-btn:hover {
    background: rgba(255, 68, 68, 0.2);
    border-color: rgba(255, 68, 68, 0.4);
    color: #ff6666;
}

/* Forum Table Header */
.forum-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(15, 15, 15, 0.9);
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.forum-header-title {
    flex: 1;
    padding-left: 48px;
}

.forum-header-stats {
    display: flex;
    gap: 16px;
}

.forum-header-stat {
    min-width: 50px;
    text-align: center;
}

.forum-header-time {
    min-width: 70px;
    text-align: right;
}

/* =============================================================================
   THREAD DETAIL MODAL
   ============================================================================= */

.thread-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.thread-modal-content {
    width: 100%;
    max-width: 1200px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: auto;
    max-height: none;
    animation: slideUp 0.3s ease;
}

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

.thread-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(20, 20, 20, 0.95);
    border-radius: 16px 16px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.thread-back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: #aaa;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.thread-back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.thread-modal-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 140px);
    scroll-behavior: auto !important; /* Prevent smooth scroll that causes jumping */
}

/* Thread detail view styling */
.thread-detail {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: visible;
}

.thread-detail-header {
    display: flex;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow: visible;
}

.thread-detail-avatar {
    flex-shrink: 0;
}

.thread-detail-info {
    flex: 1;
    overflow: visible;
}

.thread-detail-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    overflow: visible;
}

.thread-detail-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
    line-height: 1.4;
}

.thread-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85rem;
    color: #666;
    overflow: visible;
}

.thread-detail-body {
    padding: 20px 0;
    color: #ddd;
    line-height: 1.7;
    font-size: 1rem;
}

.thread-detail-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.thread-replies-section {
    margin-top: 20px;
}

.thread-replies-header {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =============================================================================
   FORUM-STYLE RESPONSIVE (MOBILE)
   ============================================================================= */

@media (max-width: 768px) {
    .forum-thread-row {
        height: auto;
        min-height: 64px;
        padding: 12px;
        flex-wrap: wrap;
        position: relative;
    }
    
    .forum-thread-category {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .forum-thread-main {
        flex: 1;
        min-width: calc(100% - 100px);
    }
    
    .forum-thread-title {
        font-size: 0.9rem;
    }
    
    .forum-thread-stats {
        display: none;
    }
    
    .forum-thread-time {
        position: absolute;
        right: 12px;
        top: 12px;
        font-size: 0.7rem;
    }
    
    .forum-thread-actions {
        opacity: 1;
        position: absolute;
        right: 12px;
        bottom: 10px;
    }
    
    .forum-action-btn {
        width: 24px;
        height: 24px;
        font-size: 0.75rem;
    }
    
    .forum-header {
        display: none;
    }
    
    .thread-modal-overlay {
        padding: 0;
    }
    
    .thread-modal-content {
        border-radius: 0;
        max-height: 100vh;
        margin: 0;
    }
    
    .thread-modal-body {
        max-height: calc(100vh - 60px);
        padding: 12px;
    }
    
    .thread-detail-title {
        font-size: 1.1rem;
    }
    
    .thread-detail-meta {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .forum-thread-row {
        padding: 10px;
        gap: 10px;
        position: relative;
    }
    
    .forum-thread-meta {
        font-size: 0.7rem;
    }
    
    .forum-thread-title {
        font-size: 0.85rem;
    }
    
    .thread-detail-header {
        flex-direction: column;
        gap: 12px;
    }
    
    .thread-detail-avatar {
        display: flex;
        justify-content: center;
    }
}

/* =============================================================================
   SUGGESTION CARD (LEGACY)
   ============================================================================= */

/* Legacy Suggestion Card - hidden in forum mode, shown in thread detail */
.suggestion-card {
    background: linear-gradient(145deg, rgba(30,30,30,0.95), rgba(18,18,18,0.98));
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 20px;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s;
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
}

.suggestion-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 16px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 15%, transparent), color-mix(in srgb, var(--accent) 10%, transparent));
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 0;
}

.suggestion-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
    border-color: color-mix(in srgb, var(--accent) 15%, transparent);
}

.suggestion-card:hover::before {
    opacity: 1;
}

.suggestion-card .card-header,
.suggestion-card .card-body,
.suggestion-card .card-actions,
.suggestion-card .replies-container {
    position: relative;
    z-index: 1;
}

.suggestion-avatar {
    flex-shrink: 0;
}

.suggestion-author {
    font-weight: 700;
    font-size: 0.95rem;
}

.time-stamp {
    font-size: 0.75rem;
    color: #666;
}

.card-body {
    color: #ddd;
    line-height: 1.6;
    font-size: 0.95rem;
    margin: 16px 0;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.text-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    transition: 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.text-btn:hover {
    color: #ffb74d;
}

/* =============================================================================
   REPLIES
   ============================================================================= */

.replies-container {
    margin-top: 16px;
    padding-left: 14px;
    border-left: 2px solid rgba(255,255,255,0.05);
    overflow-x: hidden;
}

.reply-thread-group {
    margin-top: 14px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.reply-thread-group.thread-tone-dark {
    background: linear-gradient(180deg, rgba(14, 14, 14, 0.92), rgba(10, 10, 10, 0.88));
    border-color: rgba(255, 152, 0, 0.18);
}

.reply-thread-group.thread-tone-light {
    background: linear-gradient(180deg, rgba(34, 34, 34, 0.88), rgba(28, 28, 28, 0.84));
    border-color: rgba(79, 195, 247, 0.2);
}

.reply-item {
    background: linear-gradient(145deg, rgba(20,20,20,0.9), rgba(15,15,15,0.95));
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 12px;
    padding: 14px;
    margin-top: 12px;
    transition: 0.2s;
    overflow-x: hidden;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.reply-item:hover {
    border-color: rgba(255,255,255,0.08);
}

.reply-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    max-width: 28px;
    min-height: 28px;
    max-height: 28px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
}

.reply-author {
    font-size: 0.8rem;
    font-weight: 700;
    overflow: visible;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: normal;
}

.nested-reply-item {
    display: flex;
    gap: 8px;
    background: rgba(0,0,0,0.28);
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
    border-left: none;
    overflow-x: hidden;
    overflow-y: visible;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.reply-item > div,
.nested-reply-item > div {
    min-width: 0;
}

.reply-author .profile-link-btn,
.reply-author .clickable-username {
    display: inline-flex;
    max-width: 100%;
    white-space: nowrap !important;
    overflow: visible;
}

/* "Replying to @username" reference link */
.reply-to-ref {
    display: inline-block;
    font-size: 0.65rem;
    color: rgba(255, 152, 0, 0.8);
    font-weight: 500;
    cursor: pointer;
    padding: 1px 6px;
    margin-left: 4px;
    background: rgba(255, 152, 0, 0.1);
    border-radius: 4px;
    transition: all 0.2s ease;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.reply-parent-line {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    margin-bottom: 2px;
    max-width: 100%;
    opacity: 0.92;
}

.reply-parent-label {
    font-size: 0.62rem;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    flex-shrink: 0;
}

.reply-to-ref:hover {
    background: rgba(255, 152, 0, 0.2);
    color: #ff9800;
    text-decoration: none;
}

/* Flat container for all nested replies */
.nested-replies-flat-container {
    margin-top: 10px;
}

.reply-children {
    margin-top: 8px;
    overflow-x: hidden;
    border-left: none;
    padding-left: 0;
    margin-left: 0;
}

@media (max-width: 1200px) {
    .thread-modal-content {
        max-width: 96vw;
    }
}

/* =============================================================================
   REACTIONS
   ============================================================================= */

.reaction-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    max-width: 100%;
}

.reaction-pill {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 4px 10px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: 0.2s;
    user-select: none;
}

.reaction-pill:hover {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.15);
}

.reaction-pill.active {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.reaction-count {
    font-size: 0.75rem;
    font-weight: 800;
}

.reaction-anchor {
    position: relative;
}

.reaction-hover-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.reaction-hover-trigger:hover {
    background: rgba(255,255,255,0.08);
}

.reaction-hover-trigger span {
    display: flex;
    align-items: center;
    justify-content: center;
}

.reaction-picker {
    display: none;
    position: fixed;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 25px;
    padding: 10px 14px;
    gap: 10px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.7);
    z-index: 10001;
    align-items: center;
    animation: pickerPop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

.chat-msg-me .reaction-picker {
    /* Fixed positioning - inherits from parent rule */
}

@keyframes pickerPop {
    from { opacity: 0; transform: scale(0.8) translateY(5px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.reaction-picker.show {
    display: flex;
}

.picker-emoji {
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.15s;
    padding: 4px;
}

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

.add-reaction-trigger {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    color: #888;
    cursor: pointer;
    border-radius: 8px;
    padding: 4px 8px;
    font-size: 0.9rem;
    transition: 0.2s;
}

.add-reaction-trigger:hover {
    background: rgba(255,152,0,0.1);
    border-color: rgba(255,152,0,0.2);
    color: var(--accent);
}

/* =============================================================================
   REPLY INPUT BOX
   ============================================================================= */

/* Reply Input Box - Uses same styles as global chat */
.reply-input-box {
    margin-top: 15px;
    animation: fadeInUp 0.2s;
}

.reply-input-box .input-toolbar {
    margin-bottom: 8px;
}

.reply-input-box .input-wrapper {
    position: relative;
}

.reply-input-box .chat-textarea {
    min-height: 36px;
}

/* Nested Reply Input Box */
.nested-reply-input-box {
    margin-top: 10px;
    animation: fadeInUp 0.2s;
}

.nested-reply-input-box .input-toolbar {
    margin-bottom: 6px;
}

.nested-reply-input-box .chat-textarea {
    min-height: 32px;
    font-size: 0.8rem;
}

/* =============================================================================
   COMMUNITY GUIDELINES BANNER
   ============================================================================= */

.community-guidelines-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(79,195,247,0.1), rgba(255,152,0,0.08));
    border: 1px solid rgba(79,195,247,0.2);
    border-radius: 10px;
    margin-bottom: 16px;
}

.guidelines-icon {
    font-size: 1.2rem;
}

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

.guidelines-content strong {
    color: var(--blue);
    font-size: 0.85rem;
}

.guidelines-content span {
    color: #888;
    font-size: 0.75rem;
}

.guidelines-expand {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    color: #888;
    transition: all 0.2s;
}

.guidelines-expand:hover {
    background: rgba(79,195,247,0.15);
    border-color: rgba(79,195,247,0.3);
    color: var(--blue);
}

/* =============================================================================
   GUIDELINES MODAL
   ============================================================================= */

.guidelines-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.guidelines-modal-content {
    background: linear-gradient(145deg, #1a1a1a, #141414);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.guidelines-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.guidelines-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #fff;
}

.guidelines-close {
    background: none;
    border: none;
    color: #666;
    font-size: 1.5rem;

    cursor: pointer;
    transition: 0.2s;
}

.guidelines-close:hover {
    color: #fff;
}

/* =============================================================================
   @ MENTION AUTOCOMPLETE POPUP
   ============================================================================= */

.mention-autocomplete-popup {
    display: none;
    position: fixed;
    z-index: 10000;
    background: linear-gradient(145deg, #1a1a1a, #0f0f0f);
    border: 1px solid rgba(245, 194, 17, 0.3);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 20px rgba(245, 194, 17, 0.1);
    max-height: 320px;
    overflow-y: auto;
    padding: 8px;
    backdrop-filter: blur(10px);
}

.mention-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.mention-autocomplete-item:hover {
    background: rgba(245, 194, 17, 0.1);
    border-color: rgba(245, 194, 17, 0.2);
}

.mention-autocomplete-item.selected {
    background: rgba(245, 194, 17, 0.15);
    border-color: rgba(245, 194, 17, 0.4);
}

.mention-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(245, 194, 17, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.mention-username {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
}

.mention-autocomplete-popup::-webkit-scrollbar {
    width: 6px;
}

.mention-autocomplete-popup::-webkit-scrollbar-track {
    background: transparent;
}

.mention-autocomplete-popup::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

.mention-autocomplete-popup::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* @everyone option styling */
.mention-autocomplete-item.everyone-option {
    background: rgba(76, 175, 80, 0.1);
    border-color: rgba(76, 175, 80, 0.3);
}

.mention-autocomplete-item.everyone-option:hover {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.4);
}

.mention-autocomplete-item.everyone-option.selected {
    background: rgba(76, 175, 80, 0.25);
    border-color: rgba(76, 175, 80, 0.5);
}

.everyone-hint {
    font-size: 0.75rem;
    color: rgba(76, 175, 80, 0.9);
    font-weight: 400;
    margin-left: 4px;
}

/* =============================================================================
   LOADING SKELETON FOR SUGGESTIONS
   ============================================================================= */

.suggestions-loading-skeleton {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.skeleton-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 16px;
}

.skeleton-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-text {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-title {
    width: 150px;
    height: 16px;
}

.skeleton-body {
    width: 100%;
    margin-bottom: 8px;
}

.skeleton-body.short {
    width: 70%;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Hide skeleton when content loads */
.suggestions-feed:not(:empty) .suggestions-loading-skeleton {
    display: none;
}

/* Override: show skeleton only when it's the only child */
.suggestions-loading-skeleton:only-child {
    display: flex !important;
}

/* =============================================================================
   IDEA BOARD FACELIFT
   ============================================================================= */

body.community-page .community-hub {
    max-width: 1760px;
    gap: 14px;
    padding: 14px;
    align-items: stretch;
}

body.community-page .community-main {
    background: linear-gradient(180deg, rgba(17, 21, 26, 0.98), rgba(9, 11, 14, 0.99));
    border-color: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.36);
}

body.community-page .community-sidebar-left,
body.community-page .community-sidebar-right {
    width: 280px;
    min-width: 280px;
    flex-shrink: 0 !important;
    gap: 12px;
}

/* Online User Item - Flex row layout to prevent squishing */
body.community-page .online-user-item {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 6px 10px !important;
    border-radius: 8px;
    transition: background 0.15s ease;
    cursor: pointer;
    min-height: 48px;
    box-sizing: border-box;
}

body.community-page .online-user-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Avatar button wrapper */
body.community-page .online-user-item > .profile-link-btn:first-child {
    position: relative !important;
    display: inline-block !important;
    flex-shrink: 0 !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 0 !important;
    overflow: visible !important;
}

/* Avatar image size override */
body.community-page .online-user-avatar {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 50% !important;
    border: 2px solid var(--border-color) !important;
    object-fit: cover !important;
    background: var(--bg-input) !important;
}

/* Avatar Phat wrapper override */
body.community-page .online-user-item .avatar-phat-wrap {
    width: 36px !important;
    height: 36px !important;
    display: inline-block !important;
}

/* Username button wrapper */
body.community-page .online-user-item > .profile-link-btn.online-user-name {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: calc(100% - 46px) !important;
    overflow: visible !important;
    text-align: left !important;
}

/* Username text style */
body.community-page .online-user-name {
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    color: #ddd !important;
    white-space: nowrap !important;
    overflow: visible !important;
}

body.community-page .sidebar-section {
    background: linear-gradient(180deg, rgba(20, 23, 27, 0.96), rgba(12, 14, 17, 0.98));
    border-color: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

body.community-page .sidebar-header {
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.025);
    color: #a9b3bc;
    letter-spacing: 0;
}

body.community-page .sidebar-header svg {
    color: #4fc3f7;
}

body.community-page .online-users-list,
body.community-page .activity-feed {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

body.community-page .online-user-item,
body.community-page .activity-item,
body.community-page .category-stat,
body.community-page .stat-item {
    border-radius: 8px;
}

body.community-page .quick-stats {
    gap: 7px;
    padding: 10px;
}

body.community-page .stat-item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    grid-template-areas:
        "icon value"
        "icon label";
    column-gap: 9px;
    align-items: center;
    padding: 9px 10px;
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(255, 255, 255, 0.07);
}

body.community-page .stat-item .stat-icon {
    position: static;
    grid-area: icon;
    opacity: 0.7;
    stroke: #4fc3f7;
}

body.community-page .stat-item .stat-value {
    grid-area: value;
    color: #f5c211;
    line-height: 1;
}

body.community-page .stat-item .stat-label {
    grid-area: label;
    color: #87929c;
    letter-spacing: 0;
    line-height: 1.2;
}

body.community-page .suggestions-container {
    background: linear-gradient(180deg, rgba(11, 14, 18, 0.28), rgba(7, 8, 10, 0.48));
}

.idea-board-overview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(135deg, rgba(245, 194, 17, 0.08), rgba(79, 195, 247, 0.06) 55%, rgba(76, 175, 80, 0.045));
}

.idea-board-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.idea-board-kicker {
    color: #8ea0ad;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.idea-board-heading h2 {
    margin: 0;
    color: #f4f7fa;
    font-size: 1.08rem;
    line-height: 1.2;
    letter-spacing: 0;
}

.idea-board-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

body.community-page .composer-search-box {
    min-height: 34px;
    background: rgba(5, 7, 9, 0.62);
    border-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

body.community-page .composer-search-box:focus-within {
    border-color: rgba(79, 195, 247, 0.7);
    box-shadow: 0 0 0 3px rgba(79, 195, 247, 0.12);
}

body.community-page .composer-search-box svg {
    color: #4fc3f7;
}

body.community-page .composer-search-box input {
    width: 220px;
    color: #f5f7fa;
}

.idea-board-guidelines {
    width: auto;
    min-height: 34px;
    padding: 0 11px;
    gap: 7px;
    border-radius: 8px;
    color: #d9e4ec;
    background: rgba(255, 255, 255, 0.055);
}

.idea-board-guidelines span {
    font-size: 0.78rem;
    font-weight: 700;
}

body.community-page .suggestion-composer {
    background: rgba(7, 9, 12, 0.58);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.community-page .composer-header {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.025);
    border-bottom-color: rgba(255, 255, 255, 0.06);
    color: #c4ccd3;
    letter-spacing: 0;
}

body.community-page .composer-header:hover {
    background: rgba(245, 194, 17, 0.065);
}

body.community-page .composer-header-left svg,
body.community-page .composer-header .toggle-icon {
    color: #f5c211;
}

body.community-page .composer-body {
    padding: 12px 16px 14px;
}

body.community-page .category-selector {
    margin-bottom: 10px;
}

body.community-page .category-label,
body.community-page .filter-label,
body.community-page .sort-label {
    color: #8b97a1;
    letter-spacing: 0;
}

body.community-page .category-options {
    gap: 6px;
}

body.community-page .category-btn,
body.community-page .sort-btn,
body.community-page .archived-sort-btn,
body.community-page .filter-dropdown-btn,
body.community-page .pagination-btn {
    border-radius: 8px;
    letter-spacing: 0;
}

body.community-page .category-btn {
    padding: 7px 10px;
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(255, 255, 255, 0.08);
    color: #aeb8c0;
}

body.community-page .category-btn.active {
    background: rgba(245, 194, 17, 0.14);
    border-color: rgba(245, 194, 17, 0.38);
    color: #f5d46b;
}

body.community-page .formatting-toolbar {
    background: rgba(0, 0, 0, 0.32);
    border-color: rgba(255, 255, 255, 0.09);
    border-radius: 8px;
}

body.community-page .format-btn {
    border-radius: 6px;
}

body.community-page .suggestion-textarea {
    min-height: 82px;
    background: rgba(2, 4, 6, 0.5);
    border-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

body.community-page .suggestion-textarea:focus {
    border-color: rgba(245, 194, 17, 0.65);
    box-shadow: 0 0 0 3px rgba(245, 194, 17, 0.1);
}

body.community-page .post-idea-btn {
    min-height: 30px;
    border-radius: 8px;
    padding: 6px 13px;
    box-shadow: 0 4px 12px rgba(245, 194, 17, 0.22);
}

body.community-page .suggestions-toolbar {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.025);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.community-page .filter-options,
body.community-page .sort-options,
body.community-page .archived-controls {
    gap: 7px;
}

body.community-page .filter-dropdown-btn,
body.community-page .sort-btn,
body.community-page .archived-sort-btn {
    min-height: 30px;
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(255, 255, 255, 0.08);
    color: #a9b3bc;
    padding: 6px 10px;
}

body.community-page .sort-btn.active,
body.community-page .archived-sort-btn.active {
    background: rgba(79, 195, 247, 0.12);
    border-color: rgba(79, 195, 247, 0.38);
    color: #79d8ff;
}

body.community-page .filter-dropdown-menu {
    background: rgba(12, 15, 18, 0.98);
    border-color: rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.5);
}

body.community-page .filter-option {
    border-radius: 6px;
}

body.community-page .pinned-posts-section {
    padding: 10px 16px;
    background: rgba(245, 194, 17, 0.055);
    border-bottom-color: rgba(245, 194, 17, 0.16);
}

body.community-page .pinned-header {
    margin-bottom: 8px;
    letter-spacing: 0;
}

body.community-page .pinned-post-item {
    border-radius: 8px;
    background: rgba(5, 7, 9, 0.42);
}

body.community-page .suggestions-feed {
    gap: 8px;
    padding: 10px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.28));
}

body.community-page .forum-header {
    gap: 10px;
    margin-bottom: 2px;
    padding: 7px 13px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.055);
    border-radius: 8px;
    color: #7f8b95;
    letter-spacing: 0;
}

body.community-page .forum-header-title {
    padding-left: 50px;
}

body.community-page .forum-header-stats,
body.community-page .forum-thread-stats {
    gap: 8px;
}

body.community-page .forum-header-stat,
body.community-page .forum-thread-stat {
    min-width: 48px;
}

body.community-page .forum-thread-row {
    height: 68px;
    gap: 10px;
    padding: 10px 13px;
    background: rgba(18, 21, 25, 0.9);
    border-color: rgba(255, 255, 255, 0.075);
    border-radius: 8px;
}

body.community-page .forum-thread-row:hover {
    background: rgba(25, 30, 35, 0.96);
    border-color: rgba(79, 195, 247, 0.28);
    transform: translateX(2px);
}

body.community-page .forum-thread-row.pinned {
    background: linear-gradient(90deg, rgba(245, 194, 17, 0.105), rgba(18, 21, 25, 0.94));
    border-color: rgba(245, 194, 17, 0.24);
}

body.community-page .forum-thread-category {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

body.community-page .forum-thread-main {
    gap: 5px;
}

body.community-page .forum-thread-title {
    color: #e8edf2;
    font-size: 0.94rem;
    font-weight: 700;
    line-height: 1.25;
}

body.community-page .forum-thread-meta {
    gap: 7px;
    color: #7d8892;
}

body.community-page .forum-thread-author {
    color: #a4adb6;
}

body.community-page .forum-thread-status {
    border-radius: 8px;
    padding: 3px 8px;
}

body.community-page .forum-thread-stat-value {
    color: #d7dde3;
    font-size: 0.86rem;
}

body.community-page .forum-thread-stat-label {
    color: #68747d;
    letter-spacing: 0;
}

body.community-page .forum-thread-time {
    color: #7d8892;
}

body.community-page .forum-action-btn {
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.055);
}

body.community-page .category-breakdown {
    gap: 6px;
    padding: 10px;
}

body.community-page .category-stat {
    padding: 8px 9px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.055);
}

body.community-page .category-stat:hover {
    background: rgba(79, 195, 247, 0.08);
    border-color: rgba(79, 195, 247, 0.18);
}

body.community-page .cat-stat-count,
body.community-page .online-count,
body.community-page .archived-count {
    border-radius: 8px;
}

body.community-page .activity-feed {
    padding: 10px;
}

body.community-page .activity-item {
    padding: 9px 10px;
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(255, 255, 255, 0.055);
}

body.community-page .activity-preview {
    border-left-color: rgba(79, 195, 247, 0.45);
    border-radius: 6px;
}

body.community-page .thread-modal-content {
    border-radius: 10px;
    border-color: rgba(255, 255, 255, 0.12);
    background: linear-gradient(180deg, rgba(17, 21, 26, 0.98), rgba(10, 12, 15, 0.99));
}

body.community-page .thread-modal-header {
    border-radius: 10px 10px 0 0;
    background: rgba(12, 15, 18, 0.98);
}

body.community-page .suggestion-card {
    border-radius: 8px;
    background: rgba(17, 21, 26, 0.96);
    border-color: rgba(255, 255, 255, 0.085);
    box-shadow: none;
}

body.community-page .suggestion-card::before {
    border-radius: 8px;
}

@media (max-width: 1280px) {
    body.community-page .community-hub {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 250px;
    }

    body.community-page .community-main {
        order: 1;
    }

    body.community-page .community-sidebar-right {
        order: 2;
        width: 250px;
    }

    body.community-page .community-sidebar-left {
        order: 3;
        grid-column: 1 / -1;
        width: 100%;
        max-width: none;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    }
}

@media (max-width: 980px) {
    body.community-page .community-hub {
        grid-template-columns: minmax(0, 1fr);
        padding: 10px;
    }

    body.community-page .community-sidebar-left,
    body.community-page .community-sidebar-right {
        width: 100%;
        max-width: none;
    }

    body.community-page .community-sidebar-left {
        display: flex;
    }

    body.community-page .community-main {
        order: 1;
    }

    body.community-page .community-sidebar-right {
        order: 2;
    }

    body.community-page .community-sidebar-left {
        order: 3;
    }
}

@media (max-width: 720px) {
    .idea-board-overview {
        align-items: stretch;
        flex-direction: column;
        padding: 12px;
    }

    .idea-board-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    body.community-page .composer-search-box input {
        width: 100%;
    }

    .idea-board-guidelines {
        justify-content: center;
    }

    body.community-page .suggestions-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    body.community-page .sort-options,
    body.community-page .archived-controls,
    body.community-page .filter-options {
        width: 100%;
        flex-wrap: wrap;
    }

    body.community-page .filter-dropdown,
    body.community-page .filter-dropdown-btn {
        width: 100%;
    }

    body.community-page .sort-btn,
    body.community-page .archived-sort-btn {
        flex: 1 1 auto;
    }

    body.community-page .forum-thread-row {
        height: auto;
        min-height: 70px;
        transform: none;
    }

    body.community-page .forum-thread-row:hover {
        transform: none;
    }

    body.community-page .forum-thread-time {
        min-width: auto;
    }
}

@media (max-width: 460px) {
    body.community-page .community-hub {
        padding: 8px;
        gap: 10px;
    }

    body.community-page .composer-body,
    body.community-page .composer-header,
    body.community-page .suggestions-toolbar {
        padding-left: 12px;
        padding-right: 12px;
    }

    body.community-page .category-options {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.community-page .category-btn {
        justify-content: center;
        min-width: 0;
    }

    body.community-page .forum-thread-category {
        width: 34px;
        height: 34px;
    }

    body.community-page .forum-thread-main {
        min-width: calc(100% - 84px);
    }
}

/* =============================================================================
   USER DIRECTORY
   ============================================================================= */

/* User Directory Modal Panel */
.ud-modal-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg, 16px);
    border: 1px solid var(--border-color);
    width: 94vw;
    max-width: 1200px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.25s ease;
    position: relative;
}

.ud-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px 8px;
    border-bottom: none;
    position: relative;
}

.ud-modal-header .modal-close {
    position: static;
    font-size: 1.8rem;
    color: #888;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    flex-shrink: 0;
}
.ud-modal-header .modal-close:hover {
    color: #fff;
}

.ud-modal-header .directory-title {
    margin-bottom: 0;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    padding: 14px 20px 24px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* User Card (compact tile) */
.ud-user-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    padding-top: 18px; /* extra room for party hat overflow */
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-width: 0;
    overflow: visible;
}
.ud-user-card:hover {
    background: rgba(255, 152, 0, 0.08);
    border-color: var(--accent);
}

/* Avatar wrapper with status indicator */
.ud-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    overflow: visible;
}

/* Party hat wrapper inside directory cards */
.ud-avatar-wrap .avatar-phat-wrap {
    display: block;
    width: 48px;
    height: 48px;
    overflow: visible;
}
.ud-avatar-wrap .avatar-phat-wrap::before {
    width: 62%;
    height: 62%;
    top: -36%;
}

.ud-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    background: var(--bg-input);
}
.ud-user-card:hover .ud-avatar {
    border-color: var(--accent);
}

/* Name column: stacks name row + title vertically */
.ud-name-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    gap: 1px;
}

/* Name row: name + badge + linked count */
.ud-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

/* Online/offline dot */
.ud-status-dot {
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}
.ud-status-dot.online {
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.5);
}
.ud-status-dot.offline {
    background: #555;
}

/* User name */
.ud-user-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* User title (below name) */
.ud-user-title {
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
    line-height: 1.2;
}

/* Linked players badge */
.ud-linked-badge {
    font-size: 0.7rem;
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0.85;
}

/* Online indicator dot beside name */
.ud-online-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    flex-shrink: 0;
    box-shadow: 0 0 4px rgba(74, 222, 128, 0.5);
}

/* =============================================================================
   USER DIRECTORY — Responsive
   ============================================================================= */

@media (max-width: 600px) {
    .ud-modal-panel {
        width: 96vw;
        max-height: 90vh;
    }
    .user-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 8px;
        padding: 8px 10px 32px;
    }
    .ud-user-card {
        padding: 10px 12px;
        padding-top: 14px;
        gap: 10px;
    }
    .ud-avatar-wrap,
    .ud-avatar {
        width: 36px;
        height: 36px;
    }
    .ud-avatar-wrap .avatar-phat-wrap {
        width: 36px;
        height: 36px;
    }
    .ud-status-dot {
        width: 8px;
        height: 8px;
    }
    .ud-user-name {
        font-size: 0.85rem;
    }
    .ud-user-title {
        font-size: 0.68rem;
    }
}

/* =============================================================================
   CLAN COMPETITIONS
   ============================================================================= */

/* Panel in left column */
.competitions-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.comp-empty, .comp-loading {
    text-align: center;
    color: #666;
    padding: 16px 8px;
    font-size: 0.82rem;
}

/* Competition Card */
.comp-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.comp-card:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
}

.comp-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.comp-card-icon {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    flex-shrink: 0;
}

.comp-card-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: #eee;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comp-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.comp-badge.comp-status-active {
    background: rgba(76,175,80,0.15);
    color: #4caf50;
    border: 1px solid rgba(76,175,80,0.3);
}
.comp-badge.comp-status-upcoming {
    background: rgba(33,150,243,0.15);
    color: #2196f3;
    border: 1px solid rgba(33,150,243,0.3);
}
.comp-badge.comp-status-finished {
    background: rgba(158,158,158,0.15);
    color: #9e9e9e;
    border: 1px solid rgba(158,158,158,0.3);
}

.comp-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    color: #888;
}

.comp-card-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.comp-card-time {
    font-size: 0.72rem;
    color: #999;
    margin-top: 4px;
    padding-left: 28px;
}

/* Modal Styles */
.comp-modal-content {
    max-width: 520px;
    width: 95%;
    /* Cap modal height so tall comp views (long leaderboards / prize lists)
       can't overflow the viewport. The body becomes the scroll surface. */
    max-height: min(78vh, 720px);
    display: flex;
    flex-direction: column;
}

/* Detail view modal: noticeably wider so the leaderboard breathes, and
   shorter than the create-form modal because the body scrolls internally. */
.comp-view-content {
    max-width: min(1100px, 96vw);
    width: 96%;
    max-height: min(88vh, 880px);
}

.comp-modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 20px 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
}
/* Keep the modal title bar pinned while the body scrolls */
.comp-modal-content > .modal-header { flex: 0 0 auto; }

.comp-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.comp-form-group label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #ccc;
}

.comp-optional {
    font-weight: 400;
    color: #666;
    font-size: 0.72rem;
}

.comp-input {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 8px 10px;
    color: #eee;
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.2s;
}
.comp-input:focus {
    outline: none;
    border-color: rgba(245,194,17,0.5);
}

select.comp-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    cursor: pointer;
}

select.comp-input option,
select.comp-input optgroup {
    background: var(--bg-dropdown);
    color: #eee;
}

.comp-textarea {
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
}

.comp-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.comp-error {
    background: rgba(244,67,54,0.1);
    border: 1px solid rgba(244,67,54,0.3);
    color: #f44336;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
}

.comp-submit-btn {
    margin-top: 4px;
    width: 100%;
    padding: 10px 16px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* View Competition Modal */
.comp-view-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.comp-view-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
}

.comp-view-header-info {
    flex: 1;
    min-width: 0;
}

.comp-view-title {
    font-weight: 700;
    font-size: 1rem;
    color: #eee;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comp-view-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.75rem;
    color: #888;
}

.comp-view-participants {
    color: #aaa;
}

.comp-view-info {
    flex: 1;
}

.comp-view-metric {
    font-weight: 600;
    color: #eee;
    font-size: 0.9rem;
}

.comp-view-dates {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.comp-date-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.comp-date-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comp-date-value {
    font-size: 0.8rem;
    color: #ccc;
    text-align: center;
}

.comp-date-highlight {
    color: #f5c211;
    font-weight: 700;
}

.comp-card-info {
    flex: 1;
    min-width: 0;
}

.comp-section-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: #aaa;
    margin: 0 0 6px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comp-leaderboard-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.comp-view-footer {
    text-align: center;
    font-size: 0.7rem;
    color: #555;
    padding-top: 10px;
    margin-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.04);
}

.comp-add-all-btn {
    width: 100%;
    margin-top: 8px;
    background: rgba(33,150,243,0.1);
    border-color: rgba(33,150,243,0.25);
    color: #2196f3;
}
.comp-add-all-btn:hover {
    background: rgba(33,150,243,0.2);
}

.comp-action-btn.secondary {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.12);
    color: #ccc;
}
.comp-action-btn.secondary:hover {
    background: rgba(255,255,255,0.1);
}

.comp-view-desc {
    font-size: 0.95rem;
    color: var(--text-primary, #e8e8e8);
    line-height: 1.5;
    padding: 12px 14px;
    margin: 8px 0;
    background: rgba(255,255,255,0.04);
    border-left: 3px solid var(--accent-primary, #f5c211);
    border-radius: 6px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.comp-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary, #c0c0c0);
    line-height: 1.4;
    padding: 6px 12px 0;
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comp-view-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: #aaa;
}

.comp-view-countdown {
    font-weight: 600;
    color: #f5c211;
}

/* Leaderboard */
.comp-leaderboard {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
}

.comp-lb-header {
    display: grid;
    grid-template-columns: 32px 1fr 100px;
    padding: 6px 8px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.comp-lb-row {
    display: grid;
    grid-template-columns: 32px 1fr 100px;
    padding: 8px;
    border-radius: 6px;
    align-items: center;
    transition: background 0.2s;
}
.comp-lb-row:hover {
    background: rgba(255,255,255,0.03);
}

.comp-lb-row:nth-child(2) { /* First actual row after header */
    background: rgba(255,215,0,0.05);
}

.comp-lb-rank {
    font-weight: 700;
    font-size: 0.85rem;
    color: #888;
    text-align: center;
}

.comp-lb-row:nth-child(2) .comp-lb-rank {
    color: #ffd700;
}
.comp-lb-row:nth-child(3) .comp-lb-rank {
    color: #c0c0c0;
}
.comp-lb-row:nth-child(4) .comp-lb-rank {
    color: #cd7f32;
}

.comp-lb-name {
    font-weight: 500;
    color: #eee;
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comp-lb-gained {
    font-weight: 600;
    color: #4caf50;
    font-size: 0.82rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.comp-lb-empty {
    text-align: center;
    color: #666;
    padding: 20px;
    font-size: 0.8rem;
}

/* Add Member Section */
.comp-add-member-section {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.comp-add-member-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 6px;
}
.comp-add-member-row .comp-input {
    flex: 1;
}
.comp-add-member-section .comp-error {
    margin-top: 6px;
}

/* Competition Actions */
.comp-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.comp-action-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #ccc;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.comp-action-btn:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.2);
}

.comp-action-btn.primary {
    background: rgba(245,194,17,0.15);
    border-color: rgba(245,194,17,0.3);
    color: #f5c211;
}
.comp-action-btn.primary:hover {
    background: rgba(245,194,17,0.25);
}

.comp-action-btn.danger {
    background: rgba(244,67,54,0.1);
    border-color: rgba(244,67,54,0.25);
    color: #f44336;
}
.comp-action-btn.danger:hover {
    background: rgba(244,67,54,0.2);
}

/* Panel Button */
.panel-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
    margin-right: 8px;
}

.panel-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.05);
    color: #ccc;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
    line-height: 1;
}
.panel-btn:hover {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .comp-form-row {
        grid-template-columns: 1fr;
    }
    .comp-modal-content,
    .comp-view-content {
        max-width: 100%;
        width: 100%;
        margin: 10px;
    }
    .comp-lb-header,
    .comp-lb-row {
        grid-template-columns: 28px 1fr 80px;
    }
    .comp-view-dates {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .comp-date-item {
        flex-direction: row;
        justify-content: space-between;
    }
}


/* =====================================================
   FLOATING CHAT - Base Styles
   ===================================================== */

/* Floating chat toggle button */
.floating-chat-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18), transparent 42%),
        linear-gradient(145deg, var(--accent-hover, #ffb74d) 0%, var(--accent, #ff9800) 52%, var(--accent, #ff9800) 100%);
    color: #140d00;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 32px color-mix(in srgb, var(--accent, #ff9800) 28%, transparent), inset 0 1px 0 rgba(255,255,255,0.24);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.floating-chat-btn::before {
    content: '';
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--accent-hover, #ffb74d) 28%, transparent);
    opacity: 0.8;
    animation: floatingChatPulse 2.6s ease-out infinite;
}

.floating-chat-btn::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.28);
}

.floating-chat-btn:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 18px 38px color-mix(in srgb, var(--accent, #ff9800) 42%, transparent), inset 0 1px 0 rgba(255,255,255,0.38);
    filter: saturate(1.08);
}

.floating-chat-btn.has-unread {
    animation: floatingChatUnreadBounce 0.6s ease;
}

.floating-chat-btn.has-unread::before {
    border-color: #ff5b5b;
    animation: floatingChatUnreadPulse 1.4s ease-out infinite;
}

@keyframes floatingChatUnreadBounce {
    0%, 100% { transform: scale(1); }
    40% { transform: scale(1.08); }
}

@keyframes floatingChatUnreadPulse {
    0% {
        transform: scale(1);
        opacity: 0.9;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

@keyframes floatingChatPulse {
    0% {
        transform: scale(0.92);
        opacity: 0;
    }
    25% {
        opacity: 0.7;
    }
    100% {
        transform: scale(1.14);
        opacity: 0;
    }
}

/* Unread badge on button */
.floating-chat-badge {
    position: absolute;
    top: -3px;
    right: -1px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff5b5b 0%, #d62828 100%);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    border: 2px solid #130d05;
    box-shadow: 0 8px 18px rgba(214, 40, 40, 0.36);
}

/* Chat panel */
.floating-chat-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 9999;
    width: 456px;
    max-width: calc(100vw - 32px);
    height: 680px;
    max-height: calc(100vh - 92px);
    background:
        radial-gradient(circle at top, color-mix(in srgb, var(--accent, #ff9800) 6%, transparent), transparent 34%),
        linear-gradient(180deg, #181818 0%, #111111 100%);
    border: 1px solid color-mix(in srgb, var(--accent, #ff9800) 10%, transparent);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 56px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(255,255,255,0.02) inset;
    backdrop-filter: blur(12px);
    animation: floatingChatIn 0.22s ease-out;
    isolation: isolate;
}

.floating-chat-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(255,255,255,0.025), transparent 18%, transparent 82%, rgba(255,255,255,0.015));
}

.floating-chat-panel > * {
    position: relative;
    z-index: 1;
}

.floating-chat-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9997;
    background: rgba(5, 4, 3, 0.72);
    backdrop-filter: blur(5px);
}

.floating-chat-panel-expanded {
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    width: min(920px, calc(100vw - 36px));
    max-width: min(920px, calc(100vw - 36px));
    height: min(82vh, 780px);
    max-height: min(82vh, 780px);
    transform: translate(-50%, -50%);
    border-radius: 28px;
    box-shadow: 0 32px 96px rgba(0, 0, 0, 0.68), 0 0 0 1px rgba(255,255,255,0.04) inset;
}

.floating-chat-btn-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.92);
}

@keyframes floatingChatIn {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Panel header */
.floating-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    background: linear-gradient(180deg, rgba(28, 28, 28, 0.98), rgba(21, 21, 21, 0.96));
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.floating-chat-header-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text-main, #e0e0e0);
}

.floating-chat-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--accent-hover, rgba(255, 183, 77, 0.95)), var(--accent, rgba(255, 152, 0, 0.92)));
    color: #160d00;
    box-shadow: 0 10px 24px color-mix(in srgb, var(--accent, #ff9800) 24%, transparent);
}

.floating-chat-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.floating-chat-title {
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.floating-chat-close {
    cursor: pointer;
    color: rgba(255,255,255,0.74);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    transition: color 0.15s, background 0.15s, transform 0.15s, border-color 0.15s;
}

.floating-chat-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255,255,255,0.12);
    transform: translateY(-1px);
}

.floating-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.floating-chat-users-btn,
.floating-chat-expand-btn,
.floating-chat-clear-btn {
    cursor: pointer;
    color: rgba(255,255,255,0.74);
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    transition: color 0.15s, background 0.15s, transform 0.15s, border-color 0.15s;
}

.floating-chat-users-btn:hover,
.floating-chat-expand-btn:hover,
.floating-chat-clear-btn:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(255,255,255,0.12);
    color: #fff;
    transform: translateY(-1px);
}

.floating-chat-clear-btn:hover {
    color: #f44336;
    background: rgba(244, 67, 54, 0.12);
}

.floating-chat-messages-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}

/* Messages container */
.floating-chat-messages {
    height: 100%;
    overflow-y: auto;
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background:
        linear-gradient(180deg, rgba(19, 19, 19, 0.985), rgba(15, 15, 15, 0.985)),
        radial-gradient(circle at bottom left, color-mix(in srgb, var(--accent, #ff9800) 2.5%, transparent), transparent 32%);
}
.floating-chat-messages::-webkit-scrollbar { width: 4px; }
.floating-chat-messages::-webkit-scrollbar-track { background: transparent; }
.floating-chat-messages::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
.floating-chat-messages::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

.floating-chat-jump-btn {
    position: absolute;
    right: 16px;
    bottom: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(15, 13, 10, 0.9);
    border: 1px solid color-mix(in srgb, var(--accent-hover, #ffc158) 28%, transparent);
    color: var(--accent-hover, #ffe0ac);
    box-shadow: 0 12px 30px rgba(0,0,0,0.3);
    font-size: 0.72rem;
    font-weight: 700;
    backdrop-filter: blur(8px);
    transition: transform 0.15s ease, background 0.15s ease;
    z-index: 2;
}

.floating-chat-jump-btn:hover {
    transform: translateY(-1px);
    background: rgba(29, 24, 17, 0.94);
}

/* Empty state */
.floating-chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    padding: 24px;
    color: rgba(255,255,255,0.64);
    font-size: 0.8rem;
    text-align: center;
}

.floating-chat-empty svg {
    color: #ffb13b;
    filter: drop-shadow(0 0 16px rgba(255, 177, 59, 0.18));
}

/* Individual message — base */
.floating-chat-msg-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    width: 100%;
}

.floating-chat-msg-row.fc-own {
    flex-direction: row-reverse;
}

.floating-chat-msg-row.notif-nav-highlight {
    padding: 6px;
    border-radius: 18px;
}

.floating-chat-msg-row.notif-nav-highlight .fc-bubble {
    box-shadow:
        0 0 0 2px rgba(255, 152, 0, 0.95),
        0 0 22px rgba(255, 152, 0, 0.45),
        0 16px 28px rgba(0,0,0,0.24);
}

.floating-chat-avatar-shell {
    width: 36px;
    flex: 0 0 36px;
    display: flex;
    justify-content: center;
    padding-top: 16px;
}

.floating-chat-avatar-shell-cont {
    opacity: 0;
    pointer-events: none;
}

.floating-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.floating-chat-msg {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    gap: 4px;
    width: calc(100% - 44px);
    max-width: calc(100% - 44px);
}

.floating-chat-msg.fc-own {
    align-items: flex-end;
}

.floating-chat-msg-cont {
    gap: 2px;
}

/* Header with name, badge, time */
.floating-chat-msg-header {
    display: flex;
    align-items: center;
    gap: 6px;
    width: fit-content;
    max-width: 100%;
    padding: 0 2px;
    flex-wrap: wrap;
}
.fc-own .floating-chat-msg-header {
    flex-direction: row-reverse;
    justify-content: flex-end;
}
.floating-chat-username {
    font-weight: 700;
    font-size: 0.76rem;
    letter-spacing: 0.01em;
}
.floating-chat-avatar-btn {
    display: block;
    padding: 0;
    margin: 0;
    line-height: 0;
    border-radius: 50%;
}
.floating-chat-time {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.36);
    white-space: nowrap;
}

/* Bubble wrapper */
.fc-bubble {
    position: relative;
    width: fit-content;
    max-width: min(100%, 340px);
    padding: 10px 12px;
    border-radius: 18px;
    line-height: 1.45;
    background: #1d1d1d;
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 14px 24px rgba(0,0,0,0.24);
    transition: background 0.15s, box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}

.fc-own .fc-bubble {
    box-shadow: 0 16px 28px rgba(0,0,0,0.22);
}

.fc-bubble:hover {
    transform: translateY(-1px);
}

/* Default fallbacks (overridden by inline bubble color styles) */
.fc-other .fc-bubble {
    border-top-left-radius: 6px;
}
.fc-own .fc-bubble {
    border-top-right-radius: 6px;
}

/* Continuation messages get smaller radius reset */
.floating-chat-msg-cont.fc-other .fc-bubble { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
.floating-chat-msg-cont.fc-own .fc-bubble { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }

/* Message text */
.floating-chat-msg-text {
    font-size: 0.82rem;
    color: var(--text-main, #e0e0e0);
    line-height: 1.5;
    word-break: break-word;
}
.fc-own .floating-chat-msg-text {
    color: #fff;
}

.fc-reply-quote {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
    padding: 8px 10px;
    border-left: 3px solid rgba(255, 152, 0, 0.7);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.18);
    max-width: 100%;
}

.fc-reply-quote-label {
    font-size: 0.66rem;
    font-weight: 700;
    color: rgba(255,255,255,0.72);
}

.fc-reply-quote-text {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.64);
    line-height: 1.45;
    word-break: break-word;
}

/* Inline timestamp for continuation messages */
.fc-inline-time {
    display: block;
    font-size: 0.58rem;
    color: rgba(255,255,255,0.38);
    margin-top: 4px;
    text-align: right;
}

.fc-bubble-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}

.fc-footer-left,
.fc-footer-right {
    display: flex;
    align-items: center;
    min-width: 0;
}

.fc-footer-right {
    justify-content: flex-end;
}

.fc-reaction-row {
    display: flex;
    align-items: center;
}

.fc-reaction-left {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.fc-reactions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.fc-reaction-picker-wrap {
    position: relative;
    flex-shrink: 0;
}

.fc-reaction-trigger {
    width: 20px;
    height: 20px;
    padding: 2px 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted, #666);
    transition: color 0.15s, background 0.15s;
}

.fc-reaction-trigger:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.fc-reaction-trigger svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.fc-reaction-picker {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    z-index: 5;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: 999px;
    background: #171717;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 14px 28px rgba(0,0,0,0.3);
}

.fc-reaction-picker.is-open {
    display: inline-flex;
}

.fc-reaction-option {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid transparent;
    font-size: 0.95rem;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.fc-reaction-option:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,0.08);
    border-color: rgba(255, 152, 0, 0.2);
}

.fc-reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.72);
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.fc-reaction-btn:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,0.08);
    border-color: rgba(255, 152, 0, 0.2);
    color: #fff;
}

.fc-reaction-btn.is-active {
    background: rgba(255, 152, 0, 0.14);
    border-color: rgba(255, 152, 0, 0.32);
    color: #ffd08a;
}

.fc-reaction-emoji {
    font-size: 0.88rem;
    line-height: 1;
}

.fc-reaction-count {
    min-width: 0.8rem;
    font-size: 0.68rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.floating-chat-day-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 2px;
}

.floating-chat-day-divider::before,
.floating-chat-day-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}

.floating-chat-day-divider span {
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.42);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* @mention highlight */
.floating-chat-mention {
    color: var(--accent, #ff9800);
    font-weight: 600;
}

/* ── Moderation action buttons ── */
.fc-mod-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}
.fc-bubble:hover .fc-mod-actions,
.fc-mod-actions:focus-within {
    opacity: 1;
}
.fc-mod-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    color: var(--text-muted, #666);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}
.fc-mod-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}
.fc-mod-delete:hover { color: #f44336; }
.fc-mod-mute:hover { color: #ff9800; }
.fc-mod-reply:hover { color: #ffb74d; }

.floating-chat-reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 183, 77, 0.12), rgba(255, 152, 0, 0.06));
    border: 1px solid rgba(255, 183, 77, 0.18);
    color: rgba(255,255,255,0.84);
}

.floating-chat-reply-preview-content {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.floating-chat-reply-preview-content svg {
    color: #ffb74d;
    flex-shrink: 0;
}

.floating-chat-reply-label {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.48);
    flex-shrink: 0;
}

.floating-chat-reply-username {
    font-size: 0.76rem;
    font-weight: 700;
    color: #ffcc80;
    flex-shrink: 0;
}

.floating-chat-reply-text {
    min-width: 0;
    font-size: 0.74rem;
    color: rgba(255,255,255,0.68);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.floating-chat-reply-cancel {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.5);
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.floating-chat-reply-cancel:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

/* Input area */
.floating-chat-input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px 14px;
    border-top: 1px solid rgba(255,255,255,0.05);
    background: linear-gradient(180deg, rgba(22, 22, 22, 0.99), rgba(18, 18, 18, 0.99));
    flex-shrink: 0;
    width: 100%;
}

.floating-chat-input-shell {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 6px;
    border-radius: 18px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.07);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02), 0 8px 18px rgba(0,0,0,0.18);
}

.floating-chat-emoji-wrap {
    position: relative;
    flex-shrink: 0;
}

.floating-chat-emoji-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.78);
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.floating-chat-emoji-btn:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,0.08);
    border-color: rgba(255, 152, 0, 0.24);
    color: #fff;
}

.floating-chat-emoji-btn span {
    font-size: 1.05rem;
    line-height: 1;
}

.floating-chat-emoji-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    z-index: 4;
    width: 212px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    border-radius: 16px;
    background: #171717;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 18px 34px rgba(0,0,0,0.34);
}

.floating-chat-emoji-item {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.03);
    border: 1px solid transparent;
    font-size: 1.15rem;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.floating-chat-emoji-item:hover {
    transform: translateY(-1px);
    background: rgba(255,255,255,0.08);
    border-color: rgba(255, 152, 0, 0.2);
}

.floating-chat-input {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 12px;
    padding: 8px 10px;
    color: var(--text-main, #e0e0e0);
    font-size: 0.8rem;
    font-family: inherit;
    resize: none;
    overflow-y: auto;
    max-height: 88px;
    line-height: 1.4;
    outline: none;
    min-height: 40px;
}

.floating-chat-input::placeholder {
    color: rgba(255,255,255,0.32);
}

.floating-chat-send {
    background: linear-gradient(145deg, #ffb74d 0%, #ff9800 55%, #ef6c00 100%);
    border: none;
    border-radius: 14px;
    color: #140d00;
    cursor: pointer;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 12px 24px rgba(255, 152, 0, 0.18), inset 0 1px 0 rgba(255,255,255,0.26);
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.floating-chat-send:hover {
    background: linear-gradient(145deg, #ffe082 0%, #ffb74d 55%, #fb8c00 100%);
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(255, 152, 0, 0.28), inset 0 1px 0 rgba(255,255,255,0.38);
}

.floating-chat-send:disabled {
    cursor: not-allowed;
    opacity: 0.48;
    transform: none;
    box-shadow: none;
}

.floating-chat-input-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.42);
}

body.floating-chat-expanded-mode {
    overflow: hidden;
}

body.floating-chat-expanded-mode .floating-chat-panel {
    z-index: 9998;
}

body.floating-chat-expanded-mode .floating-chat-messages {
    padding: 18px 24px 22px;
}

body.floating-chat-expanded-mode .fc-bubble {
    max-width: min(100%, 560px);
}

body.floating-chat-expanded-mode .floating-chat-input-area {
    padding: 16px 24px 22px;
}

.floating-chat-composer-hint {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.floating-chat-char-count {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

/* ============================================
 * COMPETITION ENHANCEMENTS
 * Filter tabs, prize/winner banners, progress bars,
 * gap & rate indicators, summary stats
 * ============================================ */
.comp-filter-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px 0;
    flex-wrap: wrap;
}
.comp-filter-tab {
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.04));
    color: var(--text-secondary, #aaa);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}
.comp-filter-tab:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.08));
    color: var(--text-primary, #fff);
}
.comp-filter-tab.active {
    background: var(--accent-primary, #4a9eff);
    color: #fff;
    border-color: var(--accent-primary, #4a9eff);
}

.comp-card-prize {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    background: rgba(255, 193, 7, 0.12);
    color: #ffc107;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comp-prize-banner {
    margin: 10px 0;
    padding: 10px 14px;
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.12), rgba(255, 193, 7, 0.04));
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary, #fff);
}
.comp-prize-icon { font-size: 18px; }
.comp-prize-label { color: var(--text-secondary, #aaa); font-weight: 500; }
.comp-prize-value { font-weight: 600; color: #ffc107; }

.comp-winner-banner {
    margin: 12px 0;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(255, 165, 0, 0.08));
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.1);
}
.comp-winner-trophy {
    font-size: 32px;
    line-height: 1;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.6));
}
.comp-winner-info { flex: 1; min-width: 0; }
.comp-winner-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 215, 0, 0.8);
    font-weight: 600;
}
.comp-winner-name {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.comp-winner-gained {
    font-size: 16px;
    font-weight: 700;
    color: #ffd700;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.comp-winner-banner.comp-winner-none {
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.04));
    border-color: var(--border-color, rgba(255, 255, 255, 0.1));
    box-shadow: none;
    justify-content: center;
    color: var(--text-secondary, #aaa);
    font-style: italic;
}

.comp-summary-stats {
    display: flex;
    gap: 8px;
    margin: 10px 0;
    flex-wrap: wrap;
}
.comp-stat {
    flex: 1 1 90px;
    padding: 8px 10px;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.comp-stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #888);
}
.comp-stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #fff);
    font-variant-numeric: tabular-nums;
}

/* Leaderboard row enhancements */
.comp-lb-name-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
}
.comp-progress-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.06));
    border-radius: 2px;
    overflow: hidden;
}
.comp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary, #4a9eff), #5fb3ff);
    border-radius: 2px;
    transition: width 0.4s ease;
}
.comp-progress-fill.goal-reached {
    background: linear-gradient(90deg, #4caf50, #66d36b);
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.4);
}
.comp-lb-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}
.comp-gap, .comp-rate {
    font-size: 10px;
    color: var(--text-secondary, #888);
    font-variant-numeric: tabular-nums;
}
.comp-gap-leader {
    color: #4caf50;
    font-weight: 600;
}

/* Optional label hint inside the create modal */
.comp-optional {
    font-size: 11px;
    color: var(--text-secondary, #888);
    font-weight: normal;
}

/* ==========================================================================
   Competition member picker modal
   Searchable popup used to add clan members to a competition. Replaces the
   old free-text input which was easy to mistype.
   ========================================================================== */
.comp-picker-modal-content {
    max-width: 560px;
    width: 92vw;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
}
.comp-picker-modal-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
}
.comp-picker-search {
    width: 100%;
    box-sizing: border-box;
}
.comp-picker-count {
    font-size: 12px;
    color: var(--text-muted, #9aa0a6);
}
.comp-picker-list {
    flex: 1 1 auto;
    overflow-y: auto;
    border: 1px solid var(--border-color, rgba(255,255,255,0.08));
    border-radius: 8px;
    background: rgba(0,0,0,0.18);
    min-height: 200px;
}
.comp-picker-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.12s ease;
}
.comp-picker-row:hover { background: rgba(255,255,255,0.04); }
.comp-picker-row:last-child { border-bottom: none; }
.comp-picker-row.added { opacity: 0.55; }
.comp-picker-row-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}
.comp-picker-row-name {
    font-weight: 600;
    color: var(--text-primary, #fff);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.comp-picker-row-rank {
    font-size: 11px;
    color: var(--text-muted, #9aa0a6);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.comp-picker-add-btn {
    flex: 0 0 auto;
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    background: var(--accent-primary, #4a90e2);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease;
}
.comp-picker-add-btn:hover:not(:disabled) { background: var(--accent-primary-hover, #357abd); }
.comp-picker-add-btn:disabled { cursor: default; }
.comp-picker-add-btn.added {
    background: rgba(76, 175, 80, 0.25);
    color: #8be78f;
}
.comp-picker-add-btn.error {
    background: rgba(220, 50, 50, 0.4);
    color: #ffb3b3;
}
.comp-picker-loading,
.comp-picker-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted, #9aa0a6);
    font-size: 14px;
}

/* The Manage Participants section uses the same row layout as before but no
   longer has a text input; lay the two action buttons out side-by-side. */
.comp-add-member-section .comp-add-member-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 600px) {
    .comp-picker-modal-content {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .comp-picker-row { padding: 12px; }
}
/* ==========================================================================
   Themed confirm dialog (window.appConfirm)
   Replaces native window.confirm() so the dialog matches the site theme,
   always centers in the viewport, and works inside installed PWAs where
   native confirms are sometimes silently suppressed.
   z-index sits above every other modal in the app.
   ========================================================================== */
.app-confirm-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000020;
    padding: 16px;
    animation: appConfirmFade 0.18s ease;
}
.app-confirm-overlay.closing { animation: appConfirmFadeOut 0.14s ease forwards; }
@keyframes appConfirmFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes appConfirmFadeOut { from { opacity: 1; } to { opacity: 0; } }
.app-confirm-box {
    background: var(--bg-card, #1f2329);
    color: var(--text-main, #fff);
    border: 1px solid var(--border-color, rgba(255,255,255,0.10));
    border-radius: 12px;
    width: 100%; max-width: 420px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
    overflow: hidden;
    animation: appConfirmPop 0.18s ease;
}
@keyframes appConfirmPop {
    from { transform: scale(0.92); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}
.app-confirm-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.08));
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0));
}
.app-confirm-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: var(--accent, #fff);
}
.app-confirm-body {
    padding: 18px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-main, #d4d8de);
    white-space: pre-wrap;
}
.app-confirm-actions {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color, rgba(255,255,255,0.08));
    background: rgba(0,0,0,0.18);
}
.app-confirm-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
}
.app-confirm-btn:hover { transform: translateY(-1px); }
.app-confirm-btn.cancel {
    background: rgba(255,255,255,0.08);
    color: var(--text-main, #fff);
}
.app-confirm-btn.cancel:hover { background: rgba(255,255,255,0.14); }
.app-confirm-btn.primary {
    background: var(--accent, #4a90e2);
    color: #fff;
}
.app-confirm-btn.primary:hover { background: var(--accent-hover, #357abd); }
.app-confirm-btn.danger {
    background: #d9534f;
    color: #fff;
}
.app-confirm-btn.danger:hover { background: #c9302c; }

/* The clan member picker modal needs to layer above the competition view
   modal it was opened from. modal-overlay default z-index is 2000. */
#comp-member-picker-modal { z-index: 2500 !important; }

/* ==========================================================================
   v11.99c - Competition customization additions
   All accent colors use --accent so star-store XP Tracker Skins recolor them
   automatically (tracker skins override --accent on :root / body).
   ========================================================================== */

/* Search & sort row above the comp list */
.comp-search-row {
    display: flex; gap: 8px; align-items: center;
    margin: 6px 8px 8px; flex-wrap: wrap;
}
.comp-search-input {
    flex: 1 1 200px;
    background: var(--bg-input, #111);
    border: 1px solid var(--border-color, #333);
    color: var(--text-main, #e0e0e0);
    border-radius: var(--radius-sm, 6px);
    padding: 6px 10px;
    font-size: 13px;
}
.comp-search-input:focus {
    outline: none;
    border-color: var(--accent, #ff9800);
    box-shadow: 0 0 0 2px rgba(255,152,0,0.18);
}
.comp-sort-select {
    background: var(--bg-input, #111);
    border: 1px solid var(--border-color, #333);
    color: var(--text-main, #e0e0e0);
    border-radius: var(--radius-sm, 6px);
    padding: 6px 8px;
    font-size: 13px;
    cursor: pointer;
}
.comp-sort-select:focus { outline: none; border-color: var(--accent, #ff9800); }

/* Metric category quick-filter chips inside create modal */
.comp-metric-categories {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 6px;
}
.comp-cat-chip {
    background: rgba(255,255,255,0.06);
    color: var(--text-sub, #aaa);
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.comp-cat-chip:hover { background: rgba(255,255,255,0.10); color: var(--text-main, #fff); }
.comp-cat-chip.active {
    background: var(--accent, #ff9800);
    color: #111;
    border-color: var(--accent, #ff9800);
}

/* Duration quick-pick chips */
.comp-duration-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.comp-dur-chip {
    background: rgba(255,255,255,0.06);
    color: var(--text-sub, #aaa);
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 6px);
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.comp-dur-chip:hover { background: rgba(255,255,255,0.10); color: var(--text-main, #fff); }
.comp-dur-chip.active {
    background: var(--accent, #ff9800);
    color: #111;
    border-color: var(--accent, #ff9800);
}

/* Theme color swatches */
.comp-theme-swatches {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.comp-theme-swatch {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.12s ease, border-color 0.12s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.comp-theme-swatch:hover { transform: scale(1.10); }
.comp-theme-swatch.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--accent, #ff9800), 0 2px 6px rgba(0,0,0,0.4);
    transform: scale(1.10);
}

/* Per-rank prize editor rows */
.comp-prize-rows {
    display: flex; flex-direction: column; gap: 6px;
}
.comp-prize-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    align-items: center;
    gap: 8px;
}
.comp-prize-rank {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub, #aaa);
}

/* Comp card accent bar (left edge color from theme) */
.comp-card { position: relative; overflow: hidden; }
.comp-card-accent {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--comp-accent, transparent);
}
.comp-card[style*="--comp-accent"] {
    box-shadow: 0 1px 0 rgba(255,255,255,0.04), 0 0 0 1px var(--comp-accent-glow, transparent) inset;
}
.comp-card[style*="--comp-accent"]:hover {
    box-shadow: 0 4px 16px var(--comp-accent-glow, rgba(0,0,0,0.4));
}

/* Themed wrapper inside detail modal: drives the accent for nested elements */
.comp-view-themed .comp-view-title { color: var(--comp-accent, var(--accent, var(--text-main, #fff))); }
.comp-view-themed .comp-view-icon {
    box-shadow: 0 0 0 2px var(--comp-accent-glow, transparent);
    border-radius: 6px;
}

/* Prize podium */
.comp-prize-podium {
    background: linear-gradient(135deg, rgba(245,197,24,0.10), rgba(255,255,255,0.02));
    border: 1px solid rgba(245,197,24,0.20);
    border-radius: 10px;
    padding: 12px 14px;
    margin: 10px 0;
}
.comp-prize-podium-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--gold, #f5c518);
    font-weight: 700;
    margin-bottom: 8px;
}
.comp-prize-podium-rows {
    display: flex; flex-direction: column; gap: 4px;
}
.comp-prize-podium-row {
    display: grid;
    grid-template-columns: 28px 60px 1fr;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    font-size: 14px;
}
.comp-prize-podium-medal { font-size: 18px; text-align: center; }
.comp-prize-podium-label {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-sub, #aaa);
    font-weight: 600;
}
.comp-prize-podium-reward {
    color: var(--text-main, #fff);
    font-weight: 600;
}
.comp-prize-rank-1 .comp-prize-podium-reward { color: var(--gold, #f5c518); }
.comp-prize-rank-2 .comp-prize-podium-reward { color: #c0c0c0; }
.comp-prize-rank-3 .comp-prize-podium-reward { color: #cd7f32; }
.comp-prize-other-row { border-top: 1px dashed rgba(255,255,255,0.10); padding-top: 8px; margin-top: 4px; }

/* ---- Per-row Remove (creator only) -------------------------------------
   The leaderboard row is a flex layout. We add a fixed-width column on the
   right so EVERY row has identical alignment whether or not the X is shown
   (we render an invisible spacer for non-creators / non-removable rows).
------------------------------------------------------------------------- */
.comp-lb-row {
    align-items: center;
    gap: 10px;
}
.comp-lb-remove-btn {
    flex: 0 0 28px;
    width: 28px; height: 28px;
    display: inline-flex;
    align-items: center; justify-content: center;
    background: rgba(217, 83, 79, 0.10);
    color: #ff8a85;
    border: 1px solid rgba(217, 83, 79, 0.30);
    border-radius: 50%;
    font-size: 16px; line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s, color 0.15s, transform 0.12s, border-color 0.15s;
    margin-left: auto;
}
.comp-lb-remove-btn:hover {
    background: #d9534f;
    color: #fff;
    border-color: #d9534f;
    transform: scale(1.08);
    box-shadow: 0 2px 10px rgba(217,83,79,0.40);
}
.comp-lb-remove-btn:focus-visible {
    outline: 2px solid var(--accent, #ff9800);
    outline-offset: 2px;
}
/* Reserve the same 28px gutter on rows that DON'T have a remove button so
   the entire leaderboard stays vertically aligned and looks symmetrical. */
.comp-lb-row-manageable .comp-lb-stats { margin-right: 0; }
.comp-lb-row:not(.comp-lb-row-manageable) .comp-lb-stats { padding-right: 38px; }

/* Make sure new form rows look right on narrow screens */
@media (max-width: 520px) {
    .comp-prize-row { grid-template-columns: 70px 1fr; }
    .comp-duration-chips, .comp-theme-swatches, .comp-metric-categories { gap: 4px; }
    .comp-dur-chip { padding: 5px 8px; font-size: 12px; }
    .comp-search-row { flex-direction: column; align-items: stretch; }
    .comp-sort-select { width: 100%; }
    .comp-lb-remove-btn { width: 26px; height: 26px; flex-basis: 26px; }
    .comp-lb-row:not(.comp-lb-row-manageable) .comp-lb-stats { padding-right: 32px; }
}

/* =============================================================================
   IDEA BOARD — MOBILE SCROLL + SIMPLIFIED LAYOUT
   Break nested scroll traps and hide redundant sidebars on small screens.
   ============================================================================= */

@media (max-width: 768px) {
    body.community-page {
        height: auto !important;
        min-height: 100dvh;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    body.community-page .community-hub {
        display: flex !important;
        flex-direction: column !important;
        overflow: visible !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 8px !important;
        gap: 10px !important;
    }

    body.community-page .community-main,
    body.community-page .community-panel,
    body.community-page .community-panel.active,
    body.community-page .suggestions-container {
        overflow: visible !important;
        min-height: auto !important;
        flex: none !important;
        contain: none !important;
    }

    body.community-page .suggestions-feed {
        overflow: visible !important;
        max-height: none !important;
        flex: none !important;
        padding: 8px 4px !important;
    }

    /* Sidebars duplicate filters — keep main feed first and readable */
    body.community-page .community-sidebar-left {
        display: none !important;
    }

    body.community-page .community-sidebar-right {
        order: 3;
        width: 100% !important;
        max-width: none !important;
        overflow: visible !important;
        height: auto !important;
        gap: 8px !important;
    }

    body.community-page .community-sidebar-right .categories-section .category-breakdown,
    body.community-page .community-sidebar-right .status-overview-section {
        display: none !important;
    }

    body.community-page .community-sidebar-right .activity-section {
        max-height: 220px;
    }

    body.community-page .community-sidebar-right .activity-feed {
        max-height: 160px;
    }

    body.community-page .idea-board-overview {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px 12px !important;
    }

    body.community-page .idea-board-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    body.community-page .composer-search-box input,
    body.community-page .composer-search-box.idea-board-search {
        width: 100% !important;
    }

    body.community-page .suggestion-composer .composer-body {
        padding: 10px 12px !important;
    }

    body.community-page .suggestions-toolbar {
        padding: 8px 10px !important;
        gap: 8px !important;
    }

    body.community-page .filter-options,
    body.community-page .sort-options,
    body.community-page .archived-controls {
        gap: 6px !important;
    }

    body.community-page .forum-thread-row {
        display: grid !important;
        grid-template-columns: 36px minmax(0, 1fr);
        grid-template-rows: auto auto;
        gap: 6px 10px !important;
        padding: 10px !important;
        min-height: 0 !important;
        height: auto !important;
    }

    body.community-page .forum-thread-category {
        grid-row: 1 / span 2;
        width: 36px !important;
        height: 36px !important;
        align-self: start;
    }

    body.community-page .forum-thread-main {
        min-width: 0 !important;
        width: 100% !important;
    }

    body.community-page .forum-thread-title {
        font-size: 0.88rem !important;
        line-height: 1.35 !important;
        white-space: normal !important;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    body.community-page .forum-thread-meta {
        flex-wrap: wrap !important;
        gap: 4px 8px !important;
        font-size: 0.72rem !important;
    }

    body.community-page .forum-thread-stats {
        grid-column: 2;
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    body.community-page .forum-thread-time,
    body.community-page .forum-thread-status {
        font-size: 0.68rem !important;
    }

    body.community-page .thread-modal-overlay {
        align-items: flex-start;
        overscroll-behavior: contain;
    }

    body.community-page .thread-modal-body {
        max-height: none !important;
        overflow: visible !important;
        padding: 12px !important;
    }

    body.community-page .thread-modal-content {
        min-height: 100dvh;
        max-height: none !important;
    }

    body.community-page .reply-item,
    body.community-page .nested-reply-item {
        max-width: 100% !important;
    }

    body.community-page .reply-input-box,
    body.community-page .nested-reply-input-box {
        margin-left: 0 !important;
        width: 100% !important;
        box-sizing: border-box;
    }
}

@media (max-width: 480px) {
    body.community-page .category-options {
        grid-template-columns: 1fr 1fr !important;
    }

    body.community-page .sort-btn,
    body.community-page .archived-sort-btn {
        font-size: 0.68rem !important;
        padding: 6px 8px !important;
    }

    body.community-page .community-sidebar-right .activity-section {
        display: none;
    }
}

/* =============================================================================
   SITE-WIDE MOTION POLISH - COMMUNITY AND CHAT
   ============================================================================= */
.chat-message-group,
.chat-message-item .message-content,
.emoji-cat,
.emoji-item,
.gif-item,
.mention-autocomplete-item,
.online-user-card,
.activity-feed .activity-item,
.floating-chat-panel,
.floating-chat-btn,
.app-confirm-box {
    transition: var(--transition-interactive);
}

.chat-message-group:hover,
.chat-message-item .message-content:hover,
.emoji-cat:hover,
.emoji-item:hover,
.gif-item:hover,
.mention-autocomplete-item:hover,
.online-user-card:hover,
.activity-feed .activity-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-soft);
}

.floating-chat-panel,
.emoji-picker-v2,
.gif-picker,
.mention-autocomplete-popup,
.app-confirm-box {
    animation: arcanePanelIn var(--duration-normal) var(--ease-emphasis);
}

.floating-chat-btn:hover {
    transform: translateY(var(--hover-lift-y)) scale(1.03);
    box-shadow: var(--shadow-glow-strong);
}

.app-confirm-box {
    background:
        radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 14%, transparent), transparent 45%),
        var(--bg-card, #1f2329);
    border-color: color-mix(in srgb, var(--accent) 30%, var(--border-color));
    box-shadow: 0 24px 70px rgba(0,0,0,0.58), var(--shadow-glow-soft);
}