:root {
    --arc-bg: #1b2838;
    --arc-header-bg: rgba(0, 0, 0, 0.3);
    --arc-input-area-bg: rgba(0, 0, 0, 0.2);
    --arc-input-wrapper-bg: #101822;
    --arc-msg-ai-bg: #2a475e;
    --arc-msg-ai-text: #c6d4df;
    --arc-msg-user-bg: #67c1f5;
    --arc-msg-user-text: #171a21;
    --arc-accent: #67c1f5;
    --arc-border: rgba(103, 193, 245, 0.1);
    --arc-line: rgba(255, 255, 255, 0.05);
    --arc-shadow: rgba(0, 0, 0, 0.5);
}

/* Theme Overrides - Only applied on the main page (identified by .main-page class) */
body[data-theme="sunset"] {
    --arc-bg: #f6efe3;
    --arc-header-bg: rgba(238, 108, 77, 0.1);
    --arc-input-area-bg: rgba(0, 0, 0, 0.03);
    --arc-input-wrapper-bg: #ffffff;
    --arc-msg-ai-bg: #e9e2d5;
    --arc-msg-ai-text: #13212b;
    --arc-msg-user-bg: #ee6c4d;
    --arc-msg-user-text: #ffffff;
    --arc-accent: #ee6c4d;
    --arc-border: rgba(19, 33, 43, 0.1);
}

body[data-theme="midnight"] {
    --arc-bg: #0c151d;
    --arc-header-bg: rgba(0, 0, 0, 0.4);
    --arc-input-area-bg: rgba(0, 0, 0, 0.25);
    --arc-input-wrapper-bg: #080e14;
    --arc-msg-ai-bg: #1a2a3a;
    --arc-msg-ai-text: #edf4fb;
    --arc-msg-user-bg: #7dd3fc;
    --arc-msg-user-text: #081017;
    --arc-accent: #7dd3fc;
    --arc-border: rgba(125, 211, 252, 0.15);
}

body[data-theme="gallery"] {
    --arc-bg: #f4f0e6;
    --arc-header-bg: rgba(0, 0, 0, 0.05);
    --arc-input-area-bg: rgba(0, 0, 0, 0.03);
    --arc-input-wrapper-bg: #fffdf7;
    --arc-msg-ai-bg: #e2ddd3;
    --arc-msg-ai-text: #1a2128;
    --arc-msg-user-bg: #0f6fa7;
    --arc-msg-user-text: #ffffff;
    --arc-accent: #0f6fa7;
    --arc-border: rgba(26, 33, 40, 0.1);
}

body[data-theme="aurora"] {
    --arc-bg: #ecf5f3;
    --arc-header-bg: rgba(0, 0, 0, 0.04);
    --arc-input-area-bg: rgba(0, 0, 0, 0.02);
    --arc-input-wrapper-bg: #f5fcfb;
    --arc-msg-ai-bg: #d9e6e4;
    --arc-msg-ai-text: #10242b;
    --arc-msg-user-bg: #007c91;
    --arc-msg-user-text: #ffffff;
    --arc-accent: #007c91;
    --arc-border: rgba(16, 36, 43, 0.1);
}

body[data-theme="contrast"] {
    --arc-bg: #000000;
    --arc-header-bg: rgba(255, 255, 255, 0.05);
    --arc-input-area-bg: #000000;
    --arc-input-wrapper-bg: #000000;
    --arc-msg-ai-bg: #1a1a1a;
    --arc-msg-ai-text: #ffffff;
    --arc-msg-user-bg: #fff200;
    --arc-msg-user-text: #000000;
    --arc-accent: #fff200;
    --arc-border: #ffffff;
}

body[data-theme="ember"] {
    --arc-bg: #1a0504;
    --arc-header-bg: rgba(0, 0, 0, 0.4);
    --arc-input-area-bg: rgba(0, 0, 0, 0.2);
    --arc-input-wrapper-bg: #100101;
    --arc-msg-ai-bg: #2a0c0a;
    --arc-msg-ai-text: #fff4ef;
    --arc-msg-user-bg: #ff4438;
    --arc-msg-user-text: #ffffff;
    --arc-accent: #ff4438;
    --arc-border: rgba(255, 120, 82, 0.2);
}

.steam-chat-sidebar {
    width: 380px;
    background: var(--arc-bg);
    border-left: 1px solid var(--arc-border);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 50;
    transition: width 0.1s ease, background 0.3s ease, border 0.3s ease;
    overflow: hidden;
    /* Ensure content doesn't bleed out */
    height: 100%;
    /* Fill the grid area */
}

.steam-chat-sidebar:not(.collapsed) {
    pointer-events: auto;
    visibility: visible;
}

.steam-chat-sidebar.collapsed {
    pointer-events: none;
    visibility: hidden;
}

/* Ensure the sidebar fills the grid area in integrated mode */
.steam-shell .steam-chat-sidebar {
    width: 100%;
}

/* Fixed positioning for pages like index.html that don't use the steam-shell grid */
body>.steam-chat-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;
    box-shadow: -10px 0 30px var(--arc-shadow);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
}

body>.steam-chat-sidebar.collapsed {
    transform: translateX(100%);
    pointer-events: none;
    visibility: hidden;
}

body>.chat-resize-handle {
    position: fixed;
    top: 0;
    right: 380px;
    height: 100vh;
    height: 100dvh;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body>.chat-resize-handle.collapsed {
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
}

.chat-toggle-btn {
    position: fixed;
    top: calc(var(--status-bar-safe-space) + 20px);
    right: 20px;
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 10001;
    display: grid !important;
    place-items: center !important;
    padding: 0;
    transition: transform 0.2s ease, opacity 0.2s ease, top 0.3s ease, bottom 0.3s ease;
    opacity: 0.8;
}

/* Stacking AI Icon above Messenger on Android */
html.platform-android .chat-toggle-btn {
    top: auto !important;
    bottom: calc(var(--viewport-offset-bottom, 0px) + 20px + 72px + 12px) !important;
    right: 20px !important;
    width: 72px !important;
    height: 72px !important;
    opacity: 1 !important;
}

html.platform-android .chat-toggle-btn svg {
    width: 32px !important;
    height: 32px !important;
}

body.messenger-expanded .chat-toggle-btn {
    top: calc(var(--status-bar-safe-space) + 6px);
}


.chat-toggle-btn:hover {
    transform: scale(1.1);
    opacity: 1;
}

.chat-toggle-btn svg {
    width: 28px;
    height: 28px;
    color: #67c1f5;
    /* Keep the icon blue */
    filter: drop-shadow(0 0 8px rgba(103, 193, 245, 0.5));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tab Mode for Mini Games */
.chat-toggle-btn.chat-tab-mode {
    top: 50% !important;
    right: 0 !important;
    bottom: auto !important;
    transform: translateY(-50%);
    width: 32px !important;
    height: 150px !important;
    background: #0d121a !important;
    /* Premium dark background to match image */
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-right: none !important;
    border-radius: 8px 0 0 8px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px 0 !important;
    opacity: 1 !important;
    z-index: 20000 !important;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5) !important;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.chat-toggle-btn.chat-tab-mode:hover {
    transform: translateY(-50%) scaleX(1.15);
    background: var(--arc-msg-ai-bg) !important;
}

.chat-toggle-btn.chat-tab-mode .tab-label {
    white-space: nowrap;
}

/* Ensure the tab isn't hidden by the general toggle rule if it's in tab mode */
body:not(.chat-collapsed) .chat-toggle-btn.chat-tab-mode {
    display: none !important;
    /* Only hide if the sidebar is actually open */
}

/* Hide floating toggle and messenger launcher in integrated mode (steam-shell) 
    to prevent redundant UI and overlapping icons, BUT show them if the sidebar is collapsed. 
    On mobile, we ALWAYS show the floating toggle because the integrated one is pushed down. */
@media (min-width: 769px) {

    .steam-shell .chat-toggle-btn:not(.chat-tab-mode),
    .steam-shell .messenger-launcher {
        display: none;
    }
}

body.chat-collapsed .chat-toggle-btn,
body.chat-collapsed .messenger-launcher {
    display: grid !important;
    place-items: center !important;
}

/* Hide the floating toggle when the sidebar is open */
body:not(.chat-collapsed) .chat-toggle-btn {
    display: none !important;
}

/* When NOT collapsed, move external elements to accommodate the sidebar + 20px gutter */
body:not(.chat-collapsed) .messenger-launcher,
body:not(.chat-collapsed) .chat-toggle-btn,
body:not(.chat-collapsed) .messenger-section,
body:not(.chat-collapsed) #app-runner {
    right: 400px !important;
    /* Default sidebar width (380) + 20px gutter */
}

body:not(.chat-collapsed) #app-runner {
    right: 380px !important;
    /* Runner touches the edge, but buttons need the gutter */
}

/* When collapsed, we have TWO floating buttons. Offset messenger to the left of the chat toggle. */
/* When collapsed, Messenger takes the primary corner, Sidebar toggle moves left */
body.chat-collapsed .chat-toggle-btn {
    right: 20px !important;
}

body.chat-collapsed .messenger-section {
    right: 20px !important;
}


body:not(.chat-collapsed) .messenger-launcher {
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

body:not(.chat-collapsed) .messenger-section {
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 260ms ease, opacity 180ms ease !important;
}

/* Also move the admin ban launcher if it's on the same side, 
   but it seems to be on the left (20px) in styles-2.css, 
   so we only focus on the messenger launcher for now. */

.chat-header {
    padding: 12px 16px;
    background: var(--arc-header-bg);
    border-bottom: 1px solid var(--arc-line);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 8px;
    flex-wrap: wrap;
}

.chat-header>div:first-child {
    min-width: 120px;
    flex: 1 1 auto;
}

#chat-model-select {
    width: 132px !important;
    max-width: 40vw;
    min-width: 92px;
    font-size: 0.55rem !important;
    letter-spacing: 0.45px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    background: var(--arc-input-wrapper-bg);
    color: var(--arc-msg-ai-text);
    border: 1px solid var(--arc-border);
    border-radius: 4px;
    padding: 2px 4px;
    outline: none;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

#chat-model-select option {
    background: var(--arc-input-wrapper-bg);
    color: var(--arc-msg-ai-text);
}

/* Specific overrides for light themes to ensure black text on the model selector */
body[data-theme="sunset"] #chat-model-select,
body[data-theme="gallery"] #chat-model-select,
body[data-theme="aurora"] #chat-model-select {
    color: #000000 !important;
}

@media (max-width: 768px) {
    #chat-model-select {
        width: 108px !important;
        max-width: 34vw;
        font-size: 0.52rem !important;
    }
}

/* Mobile responsive sidebar handling */
@media (max-width: 768px) {
    .chat-resize-handle {
        display: none !important;
    }

    .steam-chat-sidebar {
        position: fixed !important;
        top: 0;
        right: 0;
        height: 100vh;
        height: 100dvh;
        width: 100% !important;
        z-index: 10002;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
        border-left: none;
        box-shadow: -10px 0 30px var(--arc-shadow);
    }

    /* Android Safe Area Fix: Ensure companion starts below status bar */
    html.platform-android .steam-chat-sidebar {
        top: var(--safe-area-top, 0px) !important;
        height: calc(100dvh - var(--safe-area-top, 0px)) !important;
    }

    .steam-chat-sidebar.collapsed {
        transform: translateX(100%);
        pointer-events: none;
        visibility: hidden;
    }

    body:not(.chat-collapsed) #app-runner {
        right: 0 !important;
        /* Don't shrink the game on mobile when chat is open since it's an overlay */
    }
}

/* Android mini-games custom companion tab */
@media (max-width: 768px) {
    html.platform-android .chat-toggle-btn.chat-tab-mode {
        top: 50% !important;
        right: 0 !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;
        width: 24px !important;
        height: 112px !important;
        padding: 8px 0 !important;
        border-radius: 10px 0 0 10px !important;
        border-width: 1px !important;
        box-shadow: -6px 0 16px rgba(0, 0, 0, 0.38) !important;
        background: rgba(16, 24, 34, 0.96) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    html.platform-android .chat-toggle-btn.chat-tab-mode .tab-label {
        font-size: 0.5rem !important;
        letter-spacing: 1.7px !important;
        color: var(--arc-accent) !important;
    }

    html.platform-android .chat-toggle-btn.chat-tab-mode svg {
        width: 12px !important;
        height: 12px !important;
        margin-top: 5px !important;
        color: var(--arc-accent) !important;
        filter: none !important;
    }

    html.platform-android body.chat-collapsed .chat-toggle-btn.chat-tab-mode {
        display: flex !important;
    }
}

.close-chat-btn {
    background: var(--arc-line);
    border: 1px solid var(--arc-border);
    color: var(--arc-msg-ai-text);
    opacity: 0.6;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-chat-btn:hover {
    background: #e11d48;
    color: #fff;
    border-color: transparent;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    /* Crucial for flex shrinking */
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    padding: 12px 18px;
    border-radius: 12px;
    max-width: 90%;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-ai {
    background: var(--arc-msg-ai-bg);
    color: var(--arc-msg-ai-text);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.message-user {
    background: var(--arc-msg-user-bg);
    color: var(--arc-msg-user-text);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    font-weight: 500;
}

.chat-input-area {
    padding: 15px;
    background: var(--arc-input-area-bg);
    border-top: 1px solid var(--arc-line);
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--arc-input-wrapper-bg);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--arc-border);
}

.chat-input {
    background: transparent;
    border: none;
    color: var(--arc-msg-ai-text);
    flex: 1;
    font-size: 1rem;
    outline: none;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    min-width: 0;
    /* Allow it to shrink if needed */
}

.chat-input::placeholder {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

.chat-send-btn {
    background: none;
    border: none;
    color: #67c1f5;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.7;
}

.chat-send-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
}

.chat-send-btn.is-stop {
    color: #ff6b57;
    opacity: 1;
}

.chat-send-btn.is-stop:hover {
    transform: scale(1.05);
}

.history-btn {
    background: var(--arc-line);
    border: 1px solid var(--arc-border);
    color: var(--arc-accent);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.history-btn:hover {
    background: rgba(103, 193, 245, 0.2);
    border-color: #67c1f5;
}

.chat-history-view {
    display: none;
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.chat-history-item {
    background: var(--arc-line);
    border: 1px solid var(--arc-border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-history-item:hover {
    background: var(--arc-input-area-bg);
    border-color: var(--arc-accent);
}

.history-item-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.history-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--arc-accent);
    margin-bottom: 4px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.history-delete-btn {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border: 1px solid rgba(255, 95, 95, 0.35);
    border-radius: 50%;
    background: rgba(255, 95, 95, 0.08);
    color: #ff7777;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 800;
    line-height: 18px;
}

.history-delete-btn:hover,
.history-delete-btn:focus-visible {
    background: rgba(255, 95, 95, 0.18);
    border-color: #ff7777;
    outline: none;
}

.history-meta {
    font-size: 0.65rem;
    opacity: 0.6;
    color: var(--arc-msg-ai-text);
    display: flex;
    justify-content: space-between;
}

/* Typing indicator */
.typing-dots span {
    animation: typing 1.4s infinite;
    display: inline-block;
    margin-right: 2px;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    100% {
        opacity: 0.2;
        transform: translateY(0);
    }

    50% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

/* Code Blocks */
.code-block-wrapper {
    position: relative;
    margin: 10px 0;
}

.chat-code-block {
    background: var(--arc-input-wrapper-bg);
    border: 1px solid var(--arc-border);
    border-radius: 6px;
    padding: 24px 12px 12px 12px;
    /* Extra top padding for badges */
    margin: 0;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--arc-msg-ai-text);
    overflow-x: auto;
    white-space: pre;
    position: relative;
}

.chat-code-block::before {
    content: attr(data-lang);
    position: absolute;
    top: 0;
    left: 0;
    padding: 2px 10px;
    background: var(--arc-line);
    color: var(--arc-accent);
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    border-bottom-right-radius: 6px;
    border-top-left-radius: 5px;
    opacity: 0.8;
}

.copy-code-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--arc-border);
    border-radius: 6px;
    color: var(--arc-msg-ai-text);
    width: 28px;
    height: 28px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    backdrop-filter: blur(4px);
}

.code-block-wrapper:hover .copy-code-btn {
    opacity: 1;
}

.copy-code-btn:hover {
    background: var(--arc-accent);
    color: var(--arc-msg-user-text);
    border-color: var(--arc-accent);
    transform: scale(1.05);
}

.copy-code-btn:active {
    transform: scale(0.95);
}

.copy-code-btn svg {
    opacity: 0.8;
}

.copy-code-btn.copied {
    background: #2ecc71 !important;
    color: white !important;
    border-color: #2ecc71 !important;
    opacity: 1 !important;
}

.chat-message p {
    margin: 8px 0;
}

.chat-message p:first-child {
    margin-top: 0;
}

.chat-message p:last-child {
    margin-bottom: 0;
}

/* Resize Handle */
.chat-resize-handle {
    width: 8px;
    background: rgba(103, 193, 245, 0.12);
    cursor: col-resize;
    transition: background 0.2s, box-shadow 0.2s;
    z-index: 2201;
    position: relative;
    margin-left: -4px;
    border-left: 1px solid rgba(103, 193, 245, 0.16);
    border-right: 1px solid rgba(103, 193, 245, 0.16);
    touch-action: none;
}

.chat-resize-handle.collapsed {
    visibility: hidden;
    pointer-events: none;
}

.chat-resize-handle::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 48px;
    border-radius: 99px;
    transform: translate(-50%, -50%);
    background: rgba(103, 193, 245, 0.72);
    box-shadow: 0 0 8px rgba(103, 193, 245, 0.45);
    pointer-events: none;
}

.chat-resize-handle:hover,
.chat-resize-handle.active {
    background: var(--arc-accent);
    box-shadow: 0 0 10px var(--arc-accent);
}

/* During active game sessions, keep the splitter explicitly visible above the runner. */
body.runner-open .chat-resize-handle {
    background: rgba(103, 193, 245, 0.2);
    box-shadow: 0 0 10px rgba(103, 193, 245, 0.3);
}

/* Attachments */
.chat-attach-btn {
    background: none;
    border: none;
    color: var(--arc-msg-ai-text);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    opacity: 0.5;
}

.chat-attach-btn:hover {
    opacity: 1;
    color: var(--arc-accent);
    transform: scale(1.1);
}

.chat-attachment-preview {
    padding: 8px 16px;
    background: var(--arc-input-area-bg);
    border-top: 1px solid var(--arc-line);
}

.preview-content {
    position: relative;
    width: fit-content;
}

#chat-preview-img,
#chat-preview-video {
    max-height: 80px;
    border-radius: 4px;
    border: 1px solid var(--arc-border);
    display: block;
}

.file-preview-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: var(--arc-line);
    border-radius: 4px;
    border: 1px solid var(--arc-border);
}

.file-preview-icon span {
    font-size: 0.65rem;
    color: var(--arc-msg-ai-text);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.clear-attachment-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-message-image,
.chat-message-video {
    max-width: 100%;
    border-radius: 6px;
    margin-top: 8px;
    display: block;
    border: 1px solid var(--arc-border);
}

.chat-message-file {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--arc-input-area-bg);
    padding: 10px;
    border-radius: 6px;
    margin-top: 8px;
    border: 1px solid var(--arc-border);
    color: var(--arc-accent);
    text-decoration: none;
    font-size: 0.8rem;
}

.chat-message-file:hover {
    background: var(--arc-line);
}

.message-user .chat-message-image,
.message-user .chat-message-video {
    border-color: rgba(255, 255, 255, 0.2);
}

/* Voice Engine Styles */
.chat-send-btn.recording {
    color: #ff4444 !important;
    animation: arc-voice-pulse 1.5s infinite ease-in-out;
    filter: drop-shadow(0 0 8px rgba(255, 68, 68, 0.6));
    transform: scale(1.2);
}

@keyframes arc-voice-pulse {
    0% {
        transform: scale(1.1);
        opacity: 1;
    }

    50% {
        transform: scale(1.3);
        opacity: 0.7;
    }

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

.chat-message {
    position: relative;
}

.msg-speak-btn {
    position: absolute;
    bottom: -18px;
    left: 4px;
    background: var(--arc-input-wrapper-bg);
    border: 1px solid var(--arc-border);
    color: var(--arc-accent);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 5;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.message-ai:hover .msg-speak-btn {
    opacity: 0.8;
}

.msg-speak-btn:hover {
    opacity: 1 !important;
    transform: scale(1.1);
    background: var(--arc-accent);
    color: var(--arc-msg-user-text);
}

.msg-speak-btn svg {
    width: 12px;
    height: 12px;
}

.msg-speak-btn.speaking {
    opacity: 1 !important;
    background: var(--arc-accent);
    color: var(--arc-msg-user-text);
    border-color: var(--arc-accent);
    box-shadow: 0 0 10px var(--arc-accent-glow);
}

/* Ensure user messages don't overlap with speak button from message above */
.message-user {
    margin-top: 4px;
}
