/* --- CSS 变量 20260220 23:39 --- */
:root {

    --c-bg-sidebar: #202123;
    --c-bg-main: #ffffff;
    --c-bg-chat: #f7f7f8;
    --c-text-primary: #333333;
    --c-text-secondary: #666666;
    --c-border: #e5e5e5;

    --c-bubble-user: #19c37d;
    --c-bubble-ai: #ffffff;
    --c-bubble-border: #e5e5e5;
    --c-bubble-shadow: rgba(0,0,0,0.05);

    --c-input-bg: #ffffff;
    --c-input-border: #d9d9e3;
    --c-input-focus: #19c37d;

    --c-scrollbar-thumb: #c1c1c1;
    --c-scrollbar-track: transparent;
    --c-hover-light: rgba(0,0,0,0.05);
}

[data-theme="dark"] {
    --c-bg-sidebar: #171719;
    --c-bg-main: #343541;
    --c-bg-chat: #343541;
    --c-text-primary: #ececf1;
    --c-text-secondary: #c5c5d2;
    --c-border: #565869;

    --c-bubble-user: #19c37d;
    --c-bubble-ai: #444654;
    --c-bubble-border: #444654;
    --c-bubble-shadow: rgba(0,0,0,0.2);

    --c-input-bg: #40414f;
    --c-input-border: #565869;
    --c-input-focus: #19c37d;

    --c-scrollbar-thumb: #565869;
    --c-hover-light: rgba(255,255,255,0.1);
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--c-scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--c-scrollbar-thumb); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #6e7081; }

* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--c-bg-chat);
    color: var(--c-text-primary);
    margin: 0;
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Sidebar */
.sidebar { width: 260px; background-color: var(--c-bg-sidebar); color: #ececf1; display: flex; flex-direction: column; border-right: 1px solid #444; flex-shrink: 0; transition: width 0.3s ease; }

/* 侧边栏导航样式 */
.nav-section {
    padding: 10px 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid #444;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 4px;
    color: #ececf1;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s;
    font-size: 14px;
}

.nav-link:hover {
    background-color: #2a2b32;
}

.nav-link.active {
    background-color: #343541;
    color: #ffffff;
    font-weight: bold;
}

.nav-link svg {
    width: 18px;
    height: 18px;
    opacity: 0.8;
}

body.sidebar-hidden .sidebar { width: 0; border: none; overflow: hidden; }
.new-chat-btn { margin: 10px; padding: 12px; background-color: #343541; border: 1px solid #565869; color: white; border-radius: 5px; cursor: pointer; display: flex; align-items: center; gap: 10px; min-width: 240px; }
.history-list { flex: 1; overflow-y: auto; padding: 10px; border-top: 1px solid #444; margin-top: 5px;}
.history-item { padding: 12px; margin-bottom: 5px; border-radius: 5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; color: #ececf1; position: relative; }
.history-item:hover { background-color: #2a2b32; }
.history-item.active { background-color: #343541; font-weight: bold; }
.delete-icon { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: #aaa; opacity: 0; }
.history-item:hover .delete-icon { opacity: 1; }
.sidebar-footer { padding: 15px; border-top: 1px solid #444; display: flex; flex-direction: column; gap: 8px; min-width: 260px; }
.footer-btn-group { display: flex; gap: 8px; }
.action-btn { flex: 1; padding: 8px; background: transparent; border: 1px solid #565869; color: #ccc; border-radius: 4px; cursor: pointer; font-size: 12px; display: flex; justify-content: center; align-items: center; gap:4px; }
.action-btn:hover { background: #343541; color: white; }

.main-chat { flex: 1; display: flex; flex-direction: column; background-color: var(--c-bg-main); position: relative; min-width: 0; }

#chat-box { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 24px; background-color: var(--c-bg-chat); padding-bottom: 40px; }

.message-row { display: flex; gap: 12px; max-width: 90%; }
.message-row.user { align-self: flex-end; flex-direction: row-reverse; }
.message-row.ai { align-self: flex-start; flex-direction: row; }

.avatar { width: 36px; height: 36px; flex-shrink: 0; border-radius: 4px; display: flex; align-items: center; justify-content: center; overflow: hidden; background-color: transparent; }
.avatar.user-avatar { background-color: #999; border-radius: 6px; }
.avatar.user-avatar svg { width: 20px; height: 20px; fill: white; }
.avatar.ai-avatar img { width: 100%; height: 100%; object-fit: contain; }

.message-content { display: flex; flex-direction: column; width: 100%; min-width: 0;}
.message-bubble { padding: 12px 16px; border-radius: 12px; line-height: 1.6; word-wrap: break-word; font-size: 15px; min-height: 24px; }
.message-row.user .message-bubble {
    background-color: var(--c-bubble-ai);
    color: var(--c-text-primary);
    border: 1px solid var(--c-bubble-border);
    border-bottom-right-radius: 2px;
    white-space: pre-wrap;
    box-shadow: 0 1px 2px var(--c-bubble-shadow);
}
.message-row.ai .message-bubble { background-color: var(--c-bubble-ai); color: var(--c-text-primary); border: 1px solid var(--c-bubble-border); border-bottom-left-radius: 2px; box-shadow: 0 1px 2px var(--c-bubble-shadow); overflow-x: hidden; }

/* 代码块样式 */
.message-bubble p { margin: 0 0 10px 0; }
.message-bubble p:last-child { margin-bottom: 0; }
.code-block-wrapper { background-color: #282c34; border-radius: 8px; margin: 12px 0; overflow: hidden; border: 1px solid rgba(0,0,0,0.1); }
.code-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background-color: #21252b; border-bottom: 1px solid #3e4451; font-family: monospace; font-size: 12px; color: #abb2bf; }
.dot-group { display: flex; gap: 6px; align-items: center; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background-color: #ff5f56; }
.dot.yellow { background-color: #ffbd2e; }
.dot.green { background-color: #27c93f; }
.copy-btn { background: transparent; border: none; color: #999; cursor: pointer; font-size: 12px; display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 4px; transition: all 0.2s; }
.copy-btn:hover { background-color: rgba(255,255,255,0.1); color: white; }
.message-bubble pre { margin: 0; padding: 12px; overflow-x: auto; background: transparent; color: #abb2bf; font-family: 'Consolas', 'Monaco', monospace; font-size: 13px; }
.message-bubble pre::-webkit-scrollbar { height: 6px; }
.message-bubble pre::-webkit-scrollbar-thumb { background: #4b5263; border-radius: 3px; }
.message-bubble :not(pre) > code { background-color: rgba(175, 184, 193, 0.2); padding: 2px 4px; border-radius: 4px; font-family: monospace; font-size: 0.9em; }
.message-meta { font-size: 11px; color: var(--c-text-secondary); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.message-row.user .message-meta { justify-content: flex-end; }
.model-badge { background: var(--c-hover-light); padding: 1px 5px; border-radius: 3px; font-size: 10px; font-weight: bold; color: var(--c-text-secondary); text-transform: uppercase; }
.typing-indicator { display: flex; align-items: center; height: 24px; }
.typing-indicator span { display: block; width: 6px; height: 6px; background-color: #888; border-radius: 50%; margin-right: 4px; animation: typing 1.4s infinite ease-in-out both; }
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 80%, 100% { transform: scale(0); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }

/* 输入区域 */
.input-area { padding: 20px; background: var(--c-bg-main); border-top: 1px solid var(--c-border); display: flex; justify-content: center; }
.input-container { width: 100%; max-width: 800px; border: 1px solid var(--c-input-border); border-radius: 12px; background: var(--c-input-bg); display: flex; flex-direction: column; position: relative; transition: border-color 0.2s; }
.input-container:focus-within { border-color: var(--c-input-focus); }

/* 预览区域样式 */
.file-preview-area {
    display: flex; gap: 10px; padding: 0 15px; overflow-x: auto;
    max-height: 0; transition: max-height 0.3s ease, padding 0.3s ease;
    scrollbar-width: none;
}
.file-preview-area.active {
    padding: 10px 15px; max-height: 120px; border-bottom: 1px solid var(--c-border);
}
.file-preview-area::-webkit-scrollbar { display: none; }

.preview-item {
    position: relative; width: 60px; height: 60px; border-radius: 6px;
    background: #eee; border: 1px solid var(--c-border); flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item .file-icon { font-size: 24px; color: #666; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; }
.preview-item .file-ext { font-size: 10px; font-weight: bold; margin-top: -4px; text-transform: uppercase; }
.remove-file {
    position: absolute; top: 2px; right: 2px; width: 16px; height: 16px;
    background: rgba(0,0,0,0.6); color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; cursor: pointer; border: none;
}
.remove-file:hover { background: rgba(0,0,0,0.8); }

/* 加载遮罩 */
.uploading-overlay { position:absolute; inset:0; background: rgba(255,255,255,0.7); display:flex; align-items:center; justify-content:center; font-size:12px; color:#333; z-index:2; backdrop-filter: blur(1px); }

/* 显示在消息中的图片 */
.msg-image { max-width: 100%; border-radius: 8px; margin-top: 8px; display: block; max-height: 300px; object-fit: contain; }
.msg-file {
    display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,0.05);
    padding: 10px; border-radius: 8px; margin-top: 8px; border: 1px solid var(--c-border);
    font-size: 13px; color: var(--c-text-primary); text-decoration: none; max-width: 300px;
}
.msg-file:hover { background: rgba(0,0,0,0.08); }

textarea { width: 100%; padding: 14px 15px; border: none; resize: none; font-size: 16px; font-family: inherit; outline: none; max-height: 300px; min-height: 52px; line-height: 1.5; background: transparent; color: var(--c-text-primary); }

.input-tools { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; }
.tools-left, .tools-right { display: flex; align-items: center; gap: 8px; }

/* 上传按钮样式 */
.tool-btn {
    background: transparent; border: none; color: var(--c-text-secondary);
    width: 32px; height: 32px; border-radius: 6px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.tool-btn:hover { background: var(--c-hover-light); color: var(--c-text-primary); }
.tool-btn.disabled { opacity: 0.3; cursor: not-allowed; }
.tool-btn svg { width: 20px; height: 20px; }

/* ==========================================================================
   模型选择器
   ========================================================================== */
.custom-select {
    position: relative;
    font-size: 13px;
    user-select: none;
}

.select-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px 3px 3px;
    border: 1.5px solid var(--c-border);
    border-radius: 20px;
    background: var(--c-input-bg);
    cursor: pointer;
    color: var(--c-text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
    max-width: 260px;
}
.select-trigger:hover,
.select-trigger.open {
    border-color: var(--c-input-focus);
    box-shadow: 0 0 0 3px rgba(25, 195, 125, 0.12);
}

.trigger-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--c-hover-light);
    border: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: center;
}
.trigger-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.trigger-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--c-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

.trigger-badges {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
}

.select-trigger .trigger-left { display: contents; }
.select-trigger .trigger-right { display: contents; }
.select-trigger .trigger-right .cap-icon { width: 16px; height: 16px; }
.select-trigger .trigger-right .ctx-badge { font-size: 10px; }

.trigger-chevron {
    color: var(--c-text-secondary);
    flex-shrink: 0;
    margin-left: 2px;
    transition: transform 0.2s;
}
.select-trigger.open .trigger-chevron {
    transform: rotate(180deg);
}

.select-options {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: 320px;
    background: var(--c-input-bg);
    color: var(--c-text-primary);
    border: 1.5px solid var(--c-border);
    border-radius: 16px;
    display: none;
    margin-bottom: 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    z-index: 10;
    max-height: 440px;
    overflow-y: auto;
    padding: 6px 0 10px;
}
.select-options.open { display: block; }
[data-theme="dark"] .select-options {
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.select-options::-webkit-scrollbar { width: 5px; }
.select-options::-webkit-scrollbar-track { background: transparent; }
.select-options::-webkit-scrollbar-thumb { background: var(--c-scrollbar-thumb); border-radius: 3px; }

/* 分组标题 */
.option-group-header {
    padding: 10px 14px 4px;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.5px;
    color: #f5a623;
    text-transform: uppercase;
}
.option-group-header + .option-group-header,
.option ~ .option-group-header {
    border-top: 1px solid var(--c-border);
    margin-top: 6px;
}

.option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
    margin: 1px 6px;
    border-radius: 10px;
    transition: background 0.15s;
}
.option:hover { background: var(--c-hover-light); }
.option.selected { background: rgba(25, 195, 125, 0.08); }
[data-theme="dark"] .option.selected { background: rgba(25, 195, 125, 0.14); }

.option-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

/* 名称+标签行 */
.option-name-row {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    flex: 1;
}

.option-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--c-hover-light);
    border: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: center;
}
.option-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.option-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--c-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
}

.option-left > span {
    font-weight: 600;
    font-size: 13px;
    color: var(--c-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.option-right {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.option-check {
    width: 15px;
    height: 15px;
    color: var(--c-input-focus);
    display: none;
    flex-shrink: 0;
}
.option.selected .option-check { display: block; }

.cap-icon {
    width: 17px;
    height: 17px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cap-icon.cap-vision { background: rgba(255, 193, 7, 0.12); color: #c89000; }
.cap-icon.cap-file   { background: rgba(255, 193, 7, 0.12); color: #c89000; }
.cap-icon.cap-draw   { background: rgba(79, 172, 254, 0.12); color: #3a80c0; }
[data-theme="dark"] .cap-icon.cap-vision { background: rgba(255, 193, 7, 0.16); color: #e6a800; }
[data-theme="dark"] .cap-icon.cap-file   { background: rgba(255, 193, 7, 0.16); color: #e6a800; }
[data-theme="dark"] .cap-icon.cap-draw   { background: rgba(79, 172, 254, 0.16); color: #4facfe; }
.cap-icon svg { width: 9px; height: 9px; }

.ctx-badge {
    font-size: 10px;
    color: var(--c-text-secondary);
    font-weight: 600;
    min-width: 24px;
    text-align: right;
    white-space: nowrap;
}

/* HOT / NEW 标签 */
.model-tag {
    padding: 0px 4px;
    border-radius: 20px;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.1px;
    line-height: 1.7;
    white-space: nowrap;
    flex-shrink: 0;
}
.tag-hot { background: #f56342; color: #fff; }
.tag-new { background: #f5a623; color: #fff; }
[data-theme="dark"] .tag-hot { background: #d4522e; color: #fff; }
[data-theme="dark"] .tag-new { background: #c98a18; color: #fff; }
.trigger-badges .model-tag { display: none; }

/* 响应式 */
@media screen and (max-width: 768px) {
    .custom-select { min-width: unset; max-width: unset; }
    .select-trigger { max-width: 220px; }
    .trigger-name { max-width: 80px; font-size: 12px; }
    .select-options { min-width: 280px; left: auto; right: 0; width: 290px; }
}

@media screen and (max-width: 480px) {
    .custom-select { min-width: unset; max-width: 180px; }
    .trigger-name { max-width: 60px; font-size: 11px; }
    .trigger-badges { display: none; }
    .select-options { position: fixed; left: 12px; right: 12px; bottom: 80px; width: auto; border-radius: 16px; }
}



#send-btn { background: #19c37d; border: none; color: white; width: 32px; height: 32px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
#send-btn:hover { background: #15a268; }
#send-btn:disabled { background: #ccc; cursor: not-allowed; }
#send-btn svg { width: 16px; height: 16px; fill: white; }
#collapse-input-btn { display: none; position: absolute; right: 10px; top: 10px; border:none; background:#eee; width:24px; height:24px; border-radius:50%; align-items:center; justify-content:center; cursor: pointer;}
/* ==========================================================================
   [新增] AI 图片适配与灯箱样式
   ========================================================================== */

/* 1. 核心修复:强制限制气泡内所有图片的最大宽度 */
.message-bubble img,
.chat-generated-image {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 12px 0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    cursor: zoom-in;
    transition: transform 0.2s ease, opacity 0.2s;
    background-color: rgba(0,0,0,0.03);
}

/* 2. 鼠标悬停时的微动效 */
.message-bubble img:hover {
    transform: scale(1.02);
}

/* 3. 暗黑模式适配 */
[data-theme="dark"] .message-bubble img {
    opacity: 0.9;
    border: 1px solid var(--c-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* 4. 图片查看器样式 */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.image-lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.image-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    cursor: zoom-out;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
/* ==========================================================================
   [响应式布局] 手机端适配
   ========================================================================== */

/* 侧边栏遮罩层 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    opacity: 1;
}

/* ===== 平板 (768px 以下) ===== */
@media screen and (max-width: 768px) {

    /* --- 侧边栏:从左侧滑出的抽屉 --- */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        height: 100dvh;
        width: 280px;
        z-index: 99;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    body.sidebar-visible .sidebar {
        transform: translateX(0);
    }

    body.sidebar-visible .sidebar-overlay {
        display: block;
    }

    body.sidebar-hidden .sidebar {
        width: 280px;
        overflow: visible;
        transform: translateX(-100%);
    }

    body.sidebar-hidden.sidebar-visible .sidebar {
        transform: translateX(0);
    }

    .new-chat-btn {
        min-width: unset;
    }

    .sidebar-footer {
        min-width: unset;
    }

    /* --- 主聊天区域 --- */
    .main-chat {
        width: 100vw;
    }

    /* --- Header 调整 --- */
    #chat-header {
        padding: 10px 12px;
    }

    #header-title {
        font-size: 14px;
        max-width: 40vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* --- 消息区域 --- */
    #chat-box {
        padding: 12px 10px;
        gap: 16px;
        padding-bottom: 30px;
    }

    .message-row {
        max-width: 95%;
    }

    .message-row.ai {
        max-width: 98%;
    }

    .avatar {
        width: 30px;
        height: 30px;
    }

    .message-bubble {
        padding: 10px 12px;
        font-size: 14px;
        line-height: 1.5;
    }

    .code-block-wrapper {
        margin: 8px -4px;
    }

    .message-bubble pre {
        font-size: 12px;
        padding: 10px;
    }

    .msg-image {
        max-height: 200px;
    }

    .msg-file {
        max-width: 100%;
    }

    /* --- 输入区域 --- */
    .input-area {
        padding: 10px;
    }

    .input-container {
        border-radius: 10px;
    }

    textarea {
        font-size: 16px;
        padding: 12px;
        min-height: 44px;
    }

    .input-tools {
        padding: 6px 8px;
    }

    /* 模型选择器 - 平板 */
    .custom-select {
        min-width: 200px;
        max-width: 100%;
    }

    .select-trigger {
        padding: 5px 8px;
    }

    #current-text {
        max-width: 90px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 12px;
    }

    .select-options {
        min-width: 280px;
        left: auto;
        right: 0;
    }

    .select-trigger .trigger-right .cap-icon { width: 12px; height: 12px; }
    .select-trigger .trigger-right .ctx-badge { font-size: 9px; }




    #send-btn {
        width: 36px;
        height: 36px;
    }

    .tool-btn {
        width: 36px;
        height: 36px;
    }

    .preview-item {
        width: 50px;
        height: 50px;
    }

    .image-lightbox img {
        max-width: 95vw;
        max-height: 85vh;
    }
}

/* ===== 小手机 (480px 以下) ===== */
@media screen and (max-width: 480px) {

    .message-row {
        max-width: 98%;
        gap: 8px;
    }

    .message-row.ai {
        max-width: 100%;
    }

    .avatar {
        width: 26px;
        height: 26px;
    }

    .message-bubble {
        padding: 8px 10px;
        font-size: 14px;
        border-radius: 10px;
    }

    .message-row.user .message-bubble {
        border-bottom-right-radius: 2px;
    }

    .message-row.ai .message-bubble {
        border-bottom-left-radius: 2px;
    }

    .message-meta {
        font-size: 10px;
    }

    .model-badge {
        font-size: 9px;
    }

    #chat-box {
        padding: 8px 6px;
        gap: 12px;
    }

    .input-area {
        padding: 8px 6px;
    }

    .header-controls {
        gap: 4px;
    }

    .header-btn {
        width: 32px;
        height: 32px;
    }

    .message-bubble pre {
        font-size: 11px;
        padding: 8px;
    }

    .code-header {
        padding: 6px 8px;
        font-size: 11px;
    }

    .custom-select {
        min-width: 130px;
        max-width: 160px;
    }

    .select-options {
        min-width: auto;
        width: calc(100vw - 24px);
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 110px;
    }

    #current-text {
        max-width: 60px;
        font-size: 11px;
    }

    .select-trigger .trigger-right { display: none; }




    .tools-left {
        gap: 4px;
    }

    .nav-link {
        font-size: 13px;
        padding: 8px 10px;
    }
}

/* ===== 横屏手机处理 ===== */
@media screen and (max-height: 500px) and (orientation: landscape) {
    #chat-box {
        padding-bottom: 10px;
    }

    .input-area {
        padding: 6px 10px;
    }

    textarea {
        min-height: 36px;
        max-height: 100px;
    }

    .input-tools {
        padding: 4px 8px;
    }
}

/* ===== iOS 安全区域适配 (刘海屏/底部横条) ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .input-area {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .sidebar-footer {
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }
}
/* ==========================================================================
   AI 消息气泡 - 底部复制按钮
   ========================================================================== */
.ai-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    margin-left: 4px;
    font-size: 11px;
    color: var(--c-text-secondary);
    background: transparent;
    border: 1px solid var(--c-border);
    border-radius: 4px;
    cursor: pointer;
    vertical-align: middle;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    line-height: 1.6;
    font-family: inherit;
}

/* 鼠标悬停在整行消息时显示按钮 */
.message-row.ai:hover .ai-copy-btn {
    opacity: 1;
}

/* 按钮自身悬停样式 */
.ai-copy-btn:hover {
    color: #19c37d;
    border-color: #19c37d;
    background: rgba(25, 195, 125, 0.08);
}

/* 暗黑模式适配 */
[data-theme="dark"] .ai-copy-btn:hover {
    background: rgba(25, 195, 125, 0.12);
}

/* 复制成功状态 */
.ai-copy-btn.copied {
    color: #19c37d;
    border-color: #19c37d;
    opacity: 1;
}

/* 手机端始终显示（无hover） */
@media screen and (max-width: 768px) {
    .ai-copy-btn {
        opacity: 1;
    }
}
/* ==========================================================================
   停止生成按钮
   ========================================================================== */
#send-btn.stop-mode {
    background: transparent;
    border: 2px solid #ff5f56;
    border-radius: 6px;
    width: 32px;
    height: 32px;
}

#send-btn.stop-mode:hover {
    background: rgba(255, 95, 86, 0.1);
}

#send-btn.stop-mode svg {
    fill: #ff5f56;
    width: 12px;
    height: 12px;
}

@media screen and (max-width: 768px) {
    #send-btn.stop-mode {
        width: 36px;
        height: 36px;
    }
}
/* ===== 输入框代码预览 Chip ===== */
.code-preview-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--code-chip-bg, #1e1e2e);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    max-width: 100%;
    transition: background 0.2s;
    position: relative;
}
.code-preview-chip:hover { background: var(--code-chip-hover, #2a2a3e); }
.code-chip-lang {
    font-size: 10px;
    font-weight: 600;
    background: #6c5ce7;
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    flex-shrink: 0;
}
.code-chip-preview {
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: #a0a0b0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.code-chip-meta {
    font-size: 10px;
    color: #666;
    white-space: nowrap;
    flex-shrink: 0;
}
.code-chip-remove {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
    border-radius: 3px;
}
.code-chip-remove:hover { color: #ff5f56; background: rgba(255,95,86,0.1); }

/* ===== 用户气泡内代码折叠块 ===== */
.user-code-block {
    background: #1a1a2e;
    border: 1px solid #3a3a5c;
    border-radius: 8px;
    margin: 6px 0;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s;
}
.user-code-block:hover { border-color: #6c5ce7; }
.user-code-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: #12122a;
    user-select: none;
}
.user-code-header .code-lang-badge {
    font-size: 10px;
    font-weight: 700;
    background: #6c5ce7;
    color: #fff;
    padding: 1px 7px;
    border-radius: 4px;
    text-transform: uppercase;
}
.user-code-header .code-lines-info {
    font-size: 11px;
    color: #888;
    flex: 1;
}
.user-code-header .expand-arrow {
    font-size: 11px;
    color: #888;
    transition: transform 0.25s;
}
.user-code-block.expanded .expand-arrow { transform: rotate(90deg); }
.user-code-snippet {
    padding: 6px 12px 8px;
    font-family: 'Fira Code', monospace;
    font-size: 11px;
    color: #7a7a9a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-code-full {
    display: none;
    border-top: 1px solid #2a2a4a;
}
.user-code-full pre {
    margin: 0;
    padding: 12px;
    max-height: 400px;
    overflow: auto;
    background: #1a1a2e;
}
.user-code-full pre code { font-size: 12px; background: none; padding: 0; }
.user-code-block.expanded .user-code-full { display: block; }
.user-code-block.expanded .user-code-snippet { display: none; }

/* 浅色主题适配 */
[data-theme="light"] .user-code-block { background: #f5f5ff; border-color: #d0d0ee; }
[data-theme="light"] .user-code-header { background: #ebebf8; }
[data-theme="light"] .user-code-snippet { color: #888; }
[data-theme="light"] .user-code-full { border-color: #d0d0ee; }
[data-theme="light"] .user-code-full pre { background: #f0f0fa; }
[data-theme="light"] .code-preview-chip { background: #f0f0fa; }
[data-theme="light"] .code-preview-chip:hover { background: #e5e5f5; }
/* ==========================================================================
   BUG 修复：预览区代码 Chip + 用户气泡内代码折叠块
   ========================================================================== */

/* 修复1：代码预览 Chip 独立样式，不受 .preview-item 的 60×60 约束 */
.code-preview-chip {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    flex-shrink: 0;
    min-width: 160px;
    max-width: 280px;
    height: auto;
    min-height: 40px;
    width: auto;           /* ✅ 覆盖 preview-item 的 width:60px */
    background: var(--c-input-bg);
    border: 1.5px solid var(--c-border);
    border-radius: 8px;
    cursor: default;
    position: relative;
    box-sizing: border-box;
}

/* 修复2：关闭按钮始终可见，不被遮挡 */
.code-chip-remove {
    background: none;
    border: none;
    color: var(--c-text-secondary);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 2px 4px;
    flex-shrink: 0;
    border-radius: 3px;
    margin-left: auto;     /* ✅ 推到最右侧 */
    opacity: 0.7;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.code-chip-remove:hover {
    color: #ff5f56;
    background: rgba(255, 95, 86, 0.1);
    opacity: 1;
}

/* 修复3：用户气泡的 white-space:pre-wrap 不能污染内部代码块 */
.message-row.user .message-bubble .user-code-block {
    white-space: normal;       /* ✅ 重置，防止继承导致布局错乱 */
    color: inherit;
}
.message-row.user .message-bubble .user-code-header {
    white-space: normal;
}
.message-row.user .message-bubble .user-code-snippet {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 修复4：纯文字部分保留换行 */
.message-row.user .message-bubble .user-text-part {
    white-space: pre-wrap;
}

/* 修复5：展开/折叠状态强制生效，防止被级联覆盖 */
.user-code-block.expanded .user-code-full {
    display: block !important;
}
.user-code-block.expanded .user-code-snippet {
    display: none !important;
}

/* 修复6：内部子元素不拦截点击事件，确保点击能冒泡到父级 onclick */
.user-code-block .user-code-header,
.user-code-block .user-code-snippet {
    pointer-events: none;
}
/* ==========================================================================
   BUG 修复：预览区代码 Chip + 用户气泡内代码折叠块
   ========================================================================== */

/* 修复1：代码预览 Chip 独立尺寸，不受 .preview-item 的 60×60 约束 */
.code-preview-chip {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 7px;
    padding: 6px 12px;
    flex-shrink: 0;
    min-width: 160px;
    max-width: 280px;
    width: auto;
    height: auto;
    min-height: 40px;
    background: var(--c-input-bg);
    border: 1.5px solid var(--c-border);
    border-radius: 8px;
    cursor: default;
    position: relative;
    box-sizing: border-box;
}

/* 修复2：关闭按钮推至最右侧，始终可见 */
.code-chip-remove {
    background: none;
    border: none;
    color: var(--c-text-secondary);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 2px 4px;
    flex-shrink: 0;
    border-radius: 3px;
    margin-left: auto;
    opacity: 0.7;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.code-chip-remove:hover {
    color: #ff5f56;
    background: rgba(255, 95, 86, 0.1);
    opacity: 1;
}

/* 修复3：用户气泡的 white-space:pre-wrap 不能污染内部代码块 */
.message-row.user .message-bubble .user-code-block {
    white-space: normal;
    color: inherit;
}
.message-row.user .message-bubble .user-code-header {
    white-space: normal;
}
.message-row.user .message-bubble .user-code-snippet {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 修复4：纯文字部分保留换行 */
.message-row.user .message-bubble .user-text-part {
    white-space: pre-wrap;
}

/* 修复5：展开/折叠状态强制生效 */
.user-code-block.expanded .user-code-full {
    display: block !important;
}
.user-code-block.expanded .user-code-snippet {
    display: none !important;
}

/* 修复6：子元素不拦截点击，让事件冒泡到父级 onclick */
.user-code-block .user-code-header,
.user-code-block .user-code-snippet {
    pointer-events: none;
}
/* 块级公式：居中显示，可横向滚动 */
.math-block {
    overflow-x: auto;
    margin: 12px 0;
    padding: 4px 0;
    text-align: center;
}
.math-block .katex-display {
    margin: 0;
}

/* 行内公式字号略微放大 */
.katex {
    font-size: 1.05em;
}

/* 公式解析失败时的降级显示 */
.math-error {
    color: #e74c3c;
    font-family: monospace;
    font-size: 0.9em;
}
/* ===== 公式容器 ===== */
.math-container {
    position: relative;
}
.math-inline {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* ===== 公式操作按钮（悬停显示）===== */
.math-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    margin-left: 3px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #aaa;
    font-size: 13px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    vertical-align: middle;
    line-height: 1;
}
.math-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    margin-left: 3px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #aaa;
    font-size: 13px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s;
    vertical-align: middle;
    line-height: 1;
}
/* 👇 紧接着加这段 */
.math-action-btn svg {
    display: block;
    pointer-events: none;  /* 防止点击 svg 内部子元素时事件丢失 */
    stroke: currentColor;  /* 继承按钮的 color:#aaa，悬停变色也会同步生效 */
}
.math-container:hover .math-action-btn {
    opacity: 1;
}
.math-action-btn:hover {
    background: var(--border-color, #e0e0e0);
    color: var(--primary, #6c63ff);
}
.math-block .math-action-btn {
    position: absolute;
    top: 4px;
    right: 4px;
}

/* ===== 弹出菜单 ===== */
.math-menu-popup {
    position: absolute;
    z-index: 9999;
    background: var(--bg-primary, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    min-width: 220px;
    animation: mathMenuIn 0.15s ease;
}
@keyframes mathMenuIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}
.math-menu-title {
    font-size: 11px;
    color: var(--text-secondary, #999);
    padding: 2px 8px 6px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color, #f0f0f0);
    margin-bottom: 4px;
}
.math-menu-popup button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
    color: var(--text-primary, #333);
}
.math-menu-popup button:hover {
    background: var(--bg-secondary, #f5f5f5);
}
.math-menu-popup button span {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}
.math-menu-popup button b {
    display: block;
    font-size: 13px;
    font-weight: 600;
}
.math-menu-popup button small {
    display: block;
    font-size: 11px;
    color: var(--text-secondary, #999);
    margin-top: 1px;
}

/* ===== 轻提示 Toast ===== */
.math-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(30,30,30,0.88);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: none;
    backdrop-filter: blur(8px);
}
.math-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
/* ==========================================================================
   系统公告弹窗
   ========================================================================== */
.ann-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: annFadeIn 0.25s ease;
}
.ann-mask.active {
    display: flex;
}
@keyframes annFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.ann-dialog {
    background: var(--c-bubble-ai);
    border: 1px solid var(--c-border);
    border-radius: 16px;
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: annSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}
@keyframes annSlideUp {
    from { transform: translateY(30px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.ann-header {
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--c-border);
    font-size: 16px;
    font-weight: 700;
    color: var(--c-text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.ann-header::before {
    content: '📢';
    font-size: 18px;
}

.ann-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    font-size: 14px;
    line-height: 1.8;
    color: var(--c-text-primary);
}
.ann-body p { margin: 0 0 10px; }
.ann-body p:last-child { margin-bottom: 0; }
.ann-body a { color: #19c37d; text-decoration: underline; }

.ann-footer {
    padding: 14px 24px 18px;
    border-top: 1px solid var(--c-border);
    display: flex;
    justify-content: flex-end;
}

.ann-btn {
    padding: 9px 22px;
    border-radius: 8px;
    border: none;
    background: #19c37d;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.ann-btn:disabled {
    background: #aaa;
    cursor: not-allowed;
    opacity: 0.75;
}
.ann-btn:not(:disabled):hover {
    background: #15a268;
    transform: translateY(-1px);
}
.ann-btn:not(:disabled):active {
    transform: translateY(0);
}

.ann-countdown {
    font-size: 13px;
    opacity: 0.85;
}

/* 暗色模式适配 */
[data-theme="dark"] .ann-btn:disabled {
    background: #555;
}

/* 手机端 */
@media screen and (max-width: 480px) {
    .ann-dialog {
        width: 95%;
        max-height: 85vh;
        border-radius: 12px;
    }
    .ann-header { padding: 14px 16px 12px; font-size: 15px; }
    .ann-body   { padding: 14px 16px; }
    .ann-footer { padding: 12px 16px 14px; }
}
/* ==========================================================================
   系统公告弹窗
   ========================================================================== */
.ann-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: annFadeIn 0.25s ease;
}
.ann-mask.active {
    display: flex;
}
@keyframes annFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.ann-dialog {
    background: var(--c-bubble-ai);
    border: 1px solid var(--c-border);
    border-radius: 16px;
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: annSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}
@keyframes annSlideUp {
    from { transform: translateY(30px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.ann-header {
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--c-border);
    font-size: 16px;
    font-weight: 700;
    color: var(--c-text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.ann-header::before {
    content: '📢';
    font-size: 18px;
}

.ann-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    font-size: 14px;
    line-height: 1.8;
    color: var(--c-text-primary);
}
.ann-body p { margin: 0 0 10px; }
.ann-body p:last-child { margin-bottom: 0; }
.ann-body a { color: #19c37d; text-decoration: underline; }

.ann-footer {
    padding: 14px 24px 18px;
    border-top: 1px solid var(--c-border);
    display: flex;
    justify-content: flex-end;
}

.ann-btn {
    padding: 9px 22px;
    border-radius: 8px;
    border: none;
    background: #19c37d;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.ann-btn:disabled {
    background: #aaa;
    cursor: not-allowed;
    opacity: 0.75;
}
.ann-btn:not(:disabled):hover {
    background: #15a268;
    transform: translateY(-1px);
}
.ann-btn:not(:disabled):active {
    transform: translateY(0);
}

.ann-countdown {
    font-size: 13px;
    opacity: 0.85;
}

/* 暗色模式适配 */
[data-theme="dark"] .ann-btn:disabled {
    background: #555;
}

/* 手机端 */
@media screen and (max-width: 480px) {
    .ann-dialog {
        width: 95%;
        max-height: 85vh;
        border-radius: 12px;
    }
    .ann-header { padding: 14px 16px 12px; font-size: 15px; }
    .ann-body   { padding: 14px 16px; }
    .ann-footer { padding: 12px 16px 14px; }
}
/* ==========================================================================
   客服联系方式弹窗（复用公告弹窗风格，sup- 前缀）
   ========================================================================== */
.sup-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: supFadeIn 0.25s ease;
}
.sup-mask.active {
    display: flex;
}
@keyframes supFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.sup-dialog {
    background: var(--c-bubble-ai);
    border: 1px solid var(--c-border);
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: supSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}
@keyframes supSlideUp {
    from { transform: translateY(30px) scale(0.96); opacity: 0; }
    to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.sup-header {
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--c-border);
    font-size: 16px;
    font-weight: 700;
    color: var(--c-text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.sup-header::before {
    content: '💬';
    font-size: 18px;
}

.sup-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
    font-size: 14px;
    line-height: 1.8;
    color: var(--c-text-primary);
}
.sup-body p { margin: 0 0 10px; }
.sup-body p:last-child { margin-bottom: 0; }
.sup-body a { color: #19c37d; text-decoration: underline; }
.sup-body img { max-width: 100%; border-radius: 8px; }

.sup-footer {
    padding: 14px 24px 18px;
    border-top: 1px solid var(--c-border);
    display: flex;
    justify-content: flex-end;
}

.sup-btn {
    padding: 9px 22px;
    border-radius: 8px;
    border: none;
    background: #19c37d;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s, transform 0.1s;
}
.sup-btn:hover {
    background: #15a268;
    transform: translateY(-1px);
}
.sup-btn:active {
    transform: translateY(0);
}

.sup-loading {
    text-align: center;
    padding: 30px 20px;
    color: var(--c-text-secondary, #999);
    font-size: 14px;
}

.sup-error {
    text-align: center;
    padding: 30px 20px;
    color: #e74c3c;
    font-size: 14px;
}

[data-theme="dark"] .sup-btn {
    background: #19c37d;
}

@media screen and (max-width: 480px) {
    .sup-dialog {
        width: 95%;
        max-height: 85vh;
        border-radius: 12px;
    }
    .sup-header { padding: 14px 16px 12px; font-size: 15px; }
    .sup-body   { padding: 14px 16px; }
    .sup-footer { padding: 12px 16px 14px; }
}
