
        * {
            box-sizing: border-box;
        }
        body {
            font-family: 'Cascadia Code', 'Courier New', monospace;
            background: #1e1e1e;
            color: #d4d4d4;
            margin: 0;
            padding: 0;
            height: 100vh;
            height: 100dvh;
            overflow: hidden;
            position: relative;
        }
        /* 主容器 */
        .app-container {
            display: flex;
            height: 100%;
            width: 100%;
            overflow: hidden;
        }
        /* 左側 Agent 面板 */
        .agent-sidebar {
            width: 260px;
            background: #252526;
            border-right: 1px solid #3e3e42;
            display: flex;
            flex-direction: column;
            flex-shrink: 0;
            transition: width 0.2s;
            position: relative;
        }
        .agent-sidebar.collapsed {
            width: 60px;
        }
        .agent-sidebar.collapsed .agent-header span,
        .agent-sidebar.collapsed .agent-name {
            display: none;
        }
        .agent-header {
            padding: 12px 8px;
            font-weight: bold;
            background: #2d2d30;
            color: #4ec9b0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            white-space: nowrap;
        }
        .collapse-btn {
            background: none;
            border: none;
            color: #4ec9b0;
            cursor: pointer;
            font-size: 1rem;
            padding: 0 6px;
        }
        .agent-list {
            flex: 1;
            overflow-y: auto;
            padding: 8px;
        }
        .agent-group {
            margin-bottom: 2px;
        }
        .agent-group-header {
            padding: 6px 10px;
            margin: 10px 0 6px;
            font-size: 0.72rem;
            font-weight: bold;
            letter-spacing: 0.05em;
            color: #4ec9b0;
            background: #1e1e1e;
            border-left: 3px solid #4ec9b0;
            border-radius: 4px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            cursor: pointer;
            user-select: none;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: background 0.15s ease, border-color 0.15s ease;
        }
        .agent-group-header:hover {
            background: #252526;
            border-left-color: #6ee7c8;
        }
        .agent-group:first-child .agent-group-header {
            margin-top: 2px;
        }
        .agent-group-arrow {
            font-size: 0.6rem;
            color: #7ec8a8;
            flex-shrink: 0;
            width: 12px;
            text-align: center;
            transition: transform 0.15s ease;
        }
        .agent-group-name {
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .agent-group-count {
            flex-shrink: 0;
            font-size: 0.6rem;
            font-weight: normal;
            color: #9aa0a6;
            background: #3c3c3c;
            border-radius: 8px;
            padding: 1px 7px;
            min-width: 16px;
            text-align: center;
        }
        .agent-group.collapsed .agent-group-arrow {
            transform: rotate(-90deg);
        }
        .agent-group.collapsed .agent-group-body {
            display: none !important;
        }
        .agent-item {
            padding: 8px 10px;
            margin-bottom: 6px;
            border-radius: 8px;
            cursor: pointer;
            background: #2d2d30;
            display: flex;
            align-items: center;
            gap: 8px;
            white-space: nowrap;
        }
        .agent-item.active {
            background: #0f4c5c;
            border-left: 3px solid #4ec9b0;
        }
        .agent-item {
            padding: 8px 10px;
            margin-bottom: 6px;
            border-radius: 8px;
            cursor: pointer;
            background: #2d2d30;
            display: flex;
            align-items: center;
            gap: 8px;
            white-space: nowrap;
        }
        .agent-item.active {
            background: #0f4c5c;
            border-left: 3px solid #4ec9b0;
        }
        .agent-item.running {
            background: rgba(26, 58, 74, 0.96);
            border-left: 3px solid #4ec9b0;
            position: relative;
            box-shadow: inset 0 0 0 1px rgba(78, 201, 176, 0.18), 0 0 18px rgba(78, 201, 176, 0.16);
            overflow: hidden;
        }
        .agent-item.running::before {
            content: "";
            position: absolute;
            inset: -1px;
            border-radius: 10px;
            padding: 2px;
            background: conic-gradient(from 0deg,
                rgba(78, 201, 176, 0) 0deg,
                rgba(90, 223, 255, 0.95) 35deg,
                rgba(150, 255, 235, 0.9) 70deg,
                rgba(90, 223, 255, 0.4) 120deg,
                rgba(78, 201, 176, 0) 180deg,
                rgba(149, 235, 255, 0.9) 235deg,
                rgba(78, 201, 176, 0) 300deg,
                rgba(78, 201, 176, 0) 360deg);
            -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask-composite: exclude;
            pointer-events: none;
        }
        .agent-item.running::after {
            content: "";
            position: absolute;
            width: 10px;
            height: 10px;
            top: 1px;
            left: 1px;
            border-radius: 50%;
            background: radial-gradient(circle at 35% 35%, #ecffff 0%, #6ef2ff 20%, #4ec9b0 52%, rgba(78, 201, 176, 0.2) 100%);
            box-shadow: 0 0 12px rgba(110, 242, 255, 0.9), 0 0 20px rgba(78, 201, 176, 0.8);
            animation: beadBorderWalk 4.8s linear infinite;
            pointer-events: none;
        }
        .agent-item.has-new {
            background: #4a3a1a;
            border-left: 3px solid #e0a800;
        }

        /* === 水波特效（OXXO clip-path 技法）｜名片（agent 卡片）工作中 === */
        .agent-item.running .agent-wave,
        .agent-item.running .agent-wave::before,
        .agent-item.running .agent-wave::after {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border-radius: 8px;
            pointer-events: none;
            clip-path: ellipse(0 0 at 50% 50%);
            will-change: clip-path, opacity;
        }
        .agent-item.running .agent-wave {
            z-index: 0;
            background: radial-gradient(circle at 50% 50%, rgba(110,242,255,0.5) 0%, rgba(78,201,176,0.14) 50%, rgba(78,201,176,0) 70%);
            animation: agentWave1 3.5s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
        }
        .agent-item.running .agent-wave::before {
            background: radial-gradient(circle at 50% 50%, rgba(118,255,221,0.45) 0%, rgba(78,201,176,0.12) 50%, rgba(78,201,176,0) 70%);
            animation: agentWave2 3.5s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
        }
        .agent-item.running .agent-wave::after {
            background: radial-gradient(circle at 50% 50%, rgba(110,242,255,0.4) 0%, rgba(78,201,176,0.10) 50%, rgba(78,201,176,0) 70%);
            animation: agentWave3 3.5s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
        }
        @keyframes agentWave1 {
            0%   { clip-path: ellipse(0 0 at 50% 50%); opacity: 0.45; }
            70%  { opacity: 0.12; }
            100% { clip-path: ellipse(220% 220% at 50% 50%); opacity: 0; }
        }
        @keyframes agentWave2 {
            0%, 12% { clip-path: ellipse(0 0 at 50% 50%); opacity: 0.45; }
            82%     { opacity: 0.12; }
            100%    { clip-path: ellipse(220% 220% at 50% 50%); opacity: 0; }
        }
        @keyframes agentWave3 {
            0%, 24% { clip-path: ellipse(0 0 at 50% 50%); opacity: 0.45; }
            94%     { opacity: 0.12; }
            100%    { clip-path: ellipse(220% 220% at 50% 50%); opacity: 0; }
        }
        /* 讓卡片文字保持在波紋之上 */
        .agent-item .agent-icon,
        .agent-item .agent-name,
        .agent-item .agent-post {
            position: relative;
            z-index: 1;
        }

        .agent-icon {
            font-size: 1.2rem;
            flex-shrink: 0;
        }
        /* ws客服 名片上的 wa_auto.py 狀態小標籤 */
        .wa-auto-tag {
            display: inline-block;
            margin-left: 4px;
            padding: 0 6px;
            font-size: 0.6rem;
            line-height: 1.5;
            border-radius: 8px;
            background: #555;
            color: #fff;
            vertical-align: middle;
            white-space: nowrap;
            font-weight: normal;
        }
        .wa-auto-tag.on {
            background: #27ae60;
        }
        .wa-auto-tag.off {
            background: #e05561;
        }
        /* 左側拖拽手柄 */
        #left-resize-handle {
            width: 4px;
            background: #4ec9b0;
            cursor: ew-resize;
            position: absolute;
            right: -2px;
            top: 0;
            bottom: 0;
            z-index: 10;
        }
        /* 中央聊天區 */
        .chat-main {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-width: 0;
            background: #1e1e1e;
            bottom: 0;
        }
        .chat-header {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px 16px;
            background: #2d2d30;
            border-bottom: 1px solid #3e3e42;
            font-weight: bold;
            color: #4ec9b0;
        }
        .chat-header-left {
            flex: 1;
            min-width: 0;
            display: flex;
            align-items: center;
            overflow: hidden;
        }
        #agentHeaderDisplay {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        #stopBtn {
            flex-shrink: 0;
            background: rgba(244, 135, 113, 0.16);
            border: 1px solid rgba(244, 135, 113, 0.45);
            color: #f48771;
            border-radius: 18px;
            padding: 4px 14px;
            font-size: 0.8rem;
            font-weight: bold;
            white-space: nowrap;
        }
        #stopBtn:hover {
            background: rgba(244, 135, 113, 0.28);
        }
        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            position: relative;
        }





        /* 右側工具面板 */
        .tools-panel {
            width: 50%;
            background: #1e1e1e;
            border-left: 1px solid #3e3e42;
            display: flex;
            flex-direction: column;
            flex-shrink: 0;
            transition: width 0.2s;
            position: relative;
        }
        .tools-panel.collapsed {
            width: 40px;
        }
        .tools-panel.collapsed .tools-header span,
        .tools-panel.collapsed .tools-content {
            display: none;
        }
        .tools-header {
            padding: 8px;
            background: #2d2d30;
            border-bottom: 1px solid #3e3e42;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
        }
        .tools-header-buttons {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
        }
        .tools-header-buttons button {
            background: none;
            border: none;
            color: #ccc;
            padding: 4px 10px;
            cursor: pointer;
            border-radius: 16px;
            font-size: 0.8rem;
        }
        .tools-header-buttons button.active {
            background: #4ec9b0;
            color: #1e1e1e;
        }
.tools-token-balance{display:inline-flex;align-items:center;gap:4px;padding:4px 10px;font-size:.8rem;line-height:1;color:#e5c07b;background:#2a2a2e;border:1px solid #4a4a50;border-radius:16px;white-space:nowrap;cursor:pointer;transition:background .15s,border-color .15s;}
.tools-token-balance:hover{background:#3a3a40;border-color:#e5c07b;}
        .tools-content {
            flex: 1;
            overflow-y: auto;
            padding: 12px;
        }

        /* ===== 第二組浮動工具面板 ===== */
        .tools-panel-float {
            position: fixed;
            top: 60px;
            left: 60px;
            width: 480px;
            height: 520px;
            min-width: 320px;
            min-height: 280px;
            background: #1e1e1e;
            border: 2px solid #4ec9b0;
            border-radius: 12px;
            display: flex;
            flex-direction: column;
            z-index: 9999;
            box-shadow: 0 8px 32px rgba(0,0,0,0.6);
            resize: both;
            overflow: hidden;
        }
        .tools-header-float {
            padding: 6px 10px;
            background: #2d2d30;
            border-bottom: 1px solid #3e3e42;
            display: flex;
            align-items: center;
            justify-content: space-between;
            flex-wrap: wrap;
            cursor: move;
            user-select: none;
            flex-shrink: 0;
        }
        .tools-panel-float .tools-header-buttons {
            display: flex;
            gap: 4px;
            flex-wrap: wrap;
        }
        .tools-panel-float .tools-header-buttons button {
            background: none;
            border: none;
            color: #ccc;
            padding: 3px 8px;
            cursor: pointer;
            border-radius: 12px;
            font-size: 0.72rem;
        }
        .tools-panel-float .tools-header-buttons button.active {
            background: #4ec9b0;
            color: #1e1e1e;
        }
        .tools-panel-float .tools-content {
            flex: 1;
            overflow-y: auto;
            padding: 10px;
        }
        #closeToolsPanel2 {
            background: none;
            border: none;
            color: #f48771;
            font-size: 1rem;
            cursor: pointer;
            padding: 2px 6px;
            border-radius: 4px;
        }
        #closeToolsPanel2:hover {
            background: #f4877133;
        }
        #openToolsPanel2 {
            background: none;
            border: none;
            color: #4ec9b0;
            font-size: 1rem;
            cursor: pointer;
            padding: 2px 6px;
            border-radius: 4px;
        }
        #openToolsPanel2:hover {
            background: #4ec9b033;
        }
        /* ===== 筆記浮動面板（右下） ===== */
        .notebook-panel-float {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 480px;
            height: 520px;
            min-width: 320px;
            min-height: 280px;
            background: #1e1e1e;
            border: 2px solid #4ec9b0;
            border-radius: 12px;
            display: flex;
            flex-direction: column;
            z-index: 9999;
            box-shadow: 0 8px 32px rgba(0,0,0,0.6);
            resize: both;
            overflow: hidden;
        }
        .notebook-panel-float .notebook-title {
            color: #4ec9b0;
            font-size: 0.9rem;
            font-weight: bold;
        }
        .notebook-panel-float .notebook-content {
            flex: 1;
            overflow: hidden;
        }
        #notebookBtn {
            background: none;
            border: none;
            color: #4ec9b0;
            font-size: 0.85rem;
            cursor: pointer;
            padding: 2px 8px;
            border-radius: 12px;
        }
        #notebookBtn:hover {
            background: #4ec9b033;
        }
        #closeNotebookPanel {
            background: none;
            border: none;
            color: #f48771;
            font-size: 1rem;
            cursor: pointer;
            padding: 2px 6px;
            border-radius: 4px;
        }
        #closeNotebookPanel:hover {
            background: #f4877133;
        }
        @media (max-width: 768px) {
            .notebook-panel-float {
                width: 90vw !important;
                height: 70vh !important;
                bottom: 2vh !important;
                right: 5vw !important;
            }
        }
        /* 手機端調整浮動面板 */
        @media (max-width: 768px) {
            .tools-panel-float {
                width: 90vw !important;
                height: 70vh !important;
                top: 5vh !important;
                left: 5vw !important;
            }
        }

        /* 右側拖拽手柄 */
        #right-resize-handle {
            width: 3px;
            background: rgb(0, 0, 0,0);
            cursor: ew-resize;
            position: absolute;
            left: -2px;
            top: 0;
            bottom: 0;
            z-index: 10;
            animation: resizeHint 3s ease-in-out infinite;
            transition: width 0.3s, left 0.3s, box-shadow 0.3s;
        }
        #right-resize-handle:hover {
            width: 5px;
            left: -3px;
            box-shadow: 0 0 16px #4ec9b080;
            animation: none;
        }
        @keyframes resizeHint {
            0%,100% { box-shadow: 0 0 2px #4ec9b030; }
            50% { box-shadow: 0 0 10px #4ec9b060; }
        }
        /* content-resize-handle：隱藏拖拽手柄 */
        /* editor-path-resize-handle */
        #editor-path-resize-handle {
            height:1px; background:rgba(0, 0, 0, 0); cursor:ns-resize; flex-shrink:0;
            animation: cornerGlowPulse 4.8s ease-in-out infinite;
        }
        #editor-path-resize-handle:hover {
            height:5px;
            background:#4ec9b020;
            box-shadow: 0 0 50px #4ec9b080;
        }

        #content-resize-handle {
            height:8px; background:transparent; cursor:ns-resize; flex-shrink:0;
            position:relative;
        }
        #content-resize-handle::before {
            content:''; position:absolute; left:0; right:0; top:50%;
            height:1px; transform:translateY(-50%);
            background:#4ec9b040; transition:all 0.2s;
        }
        #content-resize-handle:hover::before {
            height:3px; background:#4ec9b0; box-shadow:0 0 50px #4ec9b080;
        }
        /* mode-toggle-bar：整列（🌐 預覽 / ✏️ 編輯）也可拖拽調整高度 */
        #mode-toggle-bar {
            cursor:ns-resize; user-select:none; -webkit-user-select:none;
        }
        #mode-toggle-bar button {
            cursor:pointer;
        }

        /* 聊天消息樣式 */
        .message {
            max-width: 85%;
            animation: fadeInUp 0.2s ease;
        }
        .message.user { align-self: flex-end; }
        .message.assistant { align-self: flex-start; }
        .message-bubble {
            padding: 8px 12px;
            border-radius: 16px;
            background: #2d2d30;
            word-wrap: break-word;
            word-break: break-all;      /* 強制長 URL 換行 */
            overflow-wrap: break-word;  /* 兼容標準寫法 */
        }
        .message.user .message-bubble { background: #0f4c5c; }
        .message-meta {
    font-size: 0.7rem;
    color: #888;
    margin-top: 10px;
    margin-bottom: 14px;
    padding-left: 10px;
    height: auto;   /* 改為 auto 以容納更多文字 */
}
        .think-container {
            background: #2a2a2e;
            border-radius: 10px;
            padding: 6px 10px;
            margin-bottom: 6px;
            border-left: 3px solid #e0a800;
        }
        .think-content {
            font-size: 0.8rem;
            color: #bbb;
        }
        .chat-input-area {
            padding: 12px ;
            background: #1e1e1e;
            border-top: 1px solid #3e3e42;
            position: relative;
        }
        .chat-input-area textarea {
            width: 100%;
            background: #1e1e1e;
            border: 1px solid #4ec9b0;
            border-radius: 24px;
            padding: 8px 14px;
            color: #d4d4d4;
            resize: vertical;
        }
        .btnBox {
            display: flex;
            gap: 8px;
            justify-content: flex-end;
            margin-top: 8px;
        }
        /* 桌面端隱藏手機面板按鈕 */
        .mobile-panel-btn {
            display: none;
        }
@media (max-width: 768px) {
    body { height: 100dvh; min-height: -webkit-fill-available; } .app-container { height: 100dvh; }

    .chat-input-area {
        height: auto;
        padding: 10px 10px 12px;
        margin: 0 10px calc(10px + env(safe-area-inset-bottom));
        background: rgba(30, 30, 34, 0.45);
        backdrop-filter: blur(20px) saturate(160%);
        -webkit-backdrop-filter: blur(20px) saturate(160%);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 22px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    }
    .chat-input-area textarea {
        width: 100%;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(78, 201, 176, 0.35);
        border-radius: 18px;
        padding: 10px 14px;
        color: #eaeaea;
        resize: none;
        font-size: 0.95rem;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    }
    .chat-input-area textarea:focus {
        outline: none;
        border-color: #4ec9b0;
        box-shadow: 0 0 0 3px rgba(78, 201, 176, 0.18);
    }

    .agent-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.2s;
        width: 40% !important;
        background: rgba(37, 37, 40, 0.78) !important;
        backdrop-filter: blur(18px) saturate(160%);
        -webkit-backdrop-filter: blur(18px) saturate(160%);
        border-right: 1px solid rgba(255, 255, 255, 0.09);
        opacity: 1;
    }
    .agent-sidebar.mobile-open {
        transform: translateX(0);
    }
    .tools-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transform: translateX(100%);
        transition: transform 0.2s;
        width: 100% !important;
        background: rgba(30, 30, 34, 0.78) !important;
        backdrop-filter: blur(18px) saturate(160%);
        -webkit-backdrop-filter: blur(18px) saturate(160%);
        border-left: 1px solid rgba(255, 255, 255, 0.09);
        opacity: 1;
    }
    .tools-panel.mobile-open {
        transform: translateX(0);
    }
    .mobile-panel-btn {
        display: inline-block;
    }
    /* 手機版：header 的緊急重啟也顯示（與桌面版統一在右上） */
    #stopBtn { display: inline-flex; }
    #left-resize-handle, #right-resize-handle {
        display: none;
    }
    #scrollToBottomBtn {
        position: fixed;
        bottom: 92px;
        right: 16px;
        width: 48px !important;
        height: 48px !important;
        font-size: 1.1rem !important;
        background: rgba(255, 255, 255, 0.08) !important;
        color: #eaeaea !important;
        border: 1px solid rgba(255, 255, 255, 0.18) !important;
        border-radius: 50% !important;
        backdrop-filter: blur(18px) saturate(160%);
        -webkit-backdrop-filter: blur(18px) saturate(160%);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.16);
        opacity: 0.82 !important;
    }
    #scrollToBottomBtn:active {
        background: rgba(255, 255, 255, 0.16) !important;
        transform: scale(0.92);
    }
    /* 展開選單時隱藏滾動按鈕，避免重疊衝突 */
    .btnBox.expanded #scrollToBottomBtn,
    .btnBox.expanded ~ #scrollToBottomBtn {
        display: none !important;
    }

    /* ===== 手機版菜單（僅手機生效） ===== */
    /* 手機版：輸入區下方按鍵 → 主層 5 鍵平均分布（每鍵約 20% 寬），只顯示 emoji */
    .btnBox {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px;
        justify-content: center;
        align-items: center;
        margin-top: 8px;
        position: relative;
        touch-action: auto !important;
    }
    .btnBox button {
        display: none;
        flex: 1 1 0;
        min-width: 0;
        height: 48px;
        padding: 0;
        margin: 0;
        font-size: 1.25rem;
        line-height: 1;
        border-radius: 16px;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.07);
        border: 1px solid rgba(255, 255, 255, 0.10);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
        color: #eaeaea;
        transition: transform 0.15s ease, background 0.15s ease;
    }
    .btnBox button:active {
        transform: scale(0.94);
        background: rgba(255, 255, 255, 0.14);
    }
    /* 手機版：隱藏按鍵文字標籤，只保留 emoji 圖示 */
    .btnBox button .btn-label {
        display: none;
    }
    /* 主層默認顯示 5 鍵：選擇對話 + 對話歷史 + 發送 + 工作 + agent頭像 */
    .btnBox button.mobile-menu-toggle,
    .btnBox button#mobileOpenLeftBtn,
    .btnBox button#jumpBtn,
    .btnBox button#mobileOpenRightBtn,
    .btnBox button#sendBtn,
    .btnBox button#recordBtn {
        display: inline-flex;
    }
    /* 主層排列（左→右）：選擇對話 → 對話歷史 → 發送 → 工作 → agent頭像 */
    .btnBox button#mobileOpenLeftBtn   { order: 1; }
    .btnBox button#jumpBtn             { order: 2; }
    .btnBox button.mobile-menu-toggle  { order: 5; }
    .btnBox button#loadCodeBtn         { order: 5; }
    .btnBox button#attachFileBtn       { order: 6; }
    .btnBox button#mobileOpenRightBtn  { order: 4; }
    .btnBox button#clearChatBtn        { order: 8; }
    .btnBox button#sendBtn             { order: 3; }
    /* agent頭像 → 圓形玻璃徽章 */
    .btnBox button.mobile-menu-toggle {
        background: rgba(78, 201, 176, 0.18);
        border: 1.5px solid rgba(78, 201, 176, 0.45);
        font-size: 1.5rem;
    }
    /* 發送鍵 → 高亮主色 */
    .btnBox button#sendBtn {
        background: linear-gradient(135deg, #4ec9b0, #2aa88f);
        border: none;
        color: #0f1f1c;
        box-shadow: 0 4px 14px rgba(78, 201, 176, 0.45);
    }
    /* ===== 水晶盤層：點 agent頭像 顯示的額外鍵（另一層水晶盤） ===== */
    .crystal-plate {
        position: absolute;
        bottom: calc(100% + 14px);
        left: -2px;
        right: -2px;
        display: none;
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0;
        justify-content: space-evenly;
        align-items: center;
        padding: 12px 10px;
        border-radius: 22px;
        background: rgba(78, 201, 176, 0.07);
        backdrop-filter: blur(26px) saturate(180%);
        -webkit-backdrop-filter: blur(26px) saturate(180%);
        border: 1px solid rgba(78, 201, 176, 0.28);
        box-shadow: 0 14px 44px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.14);
        z-index: 300;
    }
    .btnBox.expanded .crystal-plate {
        display: flex;
    }
    .crystal-plate button {
        display: inline-flex;
        flex: 0 0 20%;
        min-width: 0;
        height: 48px;
        padding: 0;
        margin: 0;
        font-size: 1.25rem;
        line-height: 1;
        border-radius: 16px;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.14);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
        color: #eaeaea;
        transition: transform 0.15s ease, background 0.15s ease;
    }
    .crystal-plate button:active {
        transform: scale(0.94);
        background: rgba(255, 255, 255, 0.16);
    }

    /* === 手機版透明沉浸模式：對話框背景 & 標題背景透明 === */
    body {
        background: transparent !important;
    }
    .app-container {
        background: rgba(18, 18, 22, 0.55) !important;
        backdrop-filter: blur(20px) saturate(160%);
        -webkit-backdrop-filter: blur(20px) saturate(160%);
    }
    .chat-main {
        background: transparent !important;
    }
    .chat-header {
        background: rgba(30, 30, 34, 0.5) !important;
        backdrop-filter: blur(12px) saturate(150%);
        -webkit-backdrop-filter: blur(12px) saturate(150%);
        border-bottom: 1px solid rgba(255, 255, 255, 0.09);
        color: #4ec9b0;
        text-shadow: 0 0 6px rgba(0,0,0,0.7);
    }
    .chat-messages {
        background: transparent !important;
    }
    .chat-input-area {
        background: rgba(30, 30, 34, 0.35) !important;
        backdrop-filter: blur(22px) saturate(170%);
        -webkit-backdrop-filter: blur(22px) saturate(170%);
        border: 1px solid rgba(255, 255, 255, 0.09) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.09);
    }
    /* 對話內容氣泡 → 完全不透明 */
    .message-bubble {
        background: #2d2d30 !important;
        opacity: 1 !important;
    }
    .message.user .message-bubble {
        background: #0f4c5c !important;
        opacity: 1 !important;
    }
    /* 輸入框保持可讀（半透明毛玻璃） */
    .chat-input-area textarea {
        background: rgba(255, 255, 255, 0.06) !important;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1px solid rgba(78, 201, 176, 0.35) !important;
    }
    /* 所有按鈕 → 完全不透明 */
    .btnBox button {
        opacity: 1 !important;
    }
    .btnBox.expanded {
        background: transparent !important;
    }
}

















        button {
            background: #4ec9b0;
            border: none;
            border-radius: 40px;
            padding: 4px 12px;
            font-weight: bold;
            color: #1e1e1e;
            cursor: pointer;
        }
        button:hover { background: #e0a800; }
        /* 文件樹 */
        .tree-container { background: #252526; padding: 12px; border-radius: 8px; overflow-x: auto; }
        ul { list-style: none; padding-left: 16px; }
        .file { color: #ce9178; cursor: pointer; }
        .dir { color: #dcdcaa; font-weight: bold; cursor: pointer; }
        .dir::before { content: '📁 '; }
        .file::before { content: '📄 '; }
        .dir.collapsed::after { content: ' ▸'; }
        .dir:not(.collapsed)::after { content: ' ▾'; }
        .dir.collapsed > ul { display: none; }
        .media-view { background: #1e1e1e; padding: 12px; border-radius: 5px; margin-top: 12px; }
        @keyframes fadeInUp {
            from { opacity: 0; transform: translateY(8px); }
            to { opacity: 1; transform: translateY(0); }
        }
        #scrollToBottomBtn {
            background: #4ec9b0;
            color: #1e1e1e;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            z-index: 200;
            display: none;
            align-items: center;
            justify-content: center;
            opacity: 0.5;
            width: 32px;
            height: 32px;
            font-size: 1rem;
            flex-shrink: 0;
        }
        /* 桌面端：回到最新按鈕浮動於輸入區上方，不佔版面，避免切換顯示時改變 .btnBox 高度造成跳動 */
        @media (min-width: 769px) {
            #scrollToBottomBtn {
                position: absolute;
                right: 12px;
                bottom: calc(100% + 12px);
            }
        }

        .message-bubble h1, .message-bubble h2, .message-bubble h3 {
            margin: 0.5em 0;
            color: #4ec9b0;
        }
        .message-bubble p {
            margin: 0.5em 0;
            line-height: 1.4;
        }
        .message-bubble pre {
            background: #1e1e1e;
            padding: 10px;
            border-radius: 8px;
            overflow-x: auto;
        }
        .message-bubble code {
            background: #2d2d30;
            padding: 2px 6px;
            border-radius: 4px;
            font-family: monospace;
        }
        .message-bubble blockquote {
            border-left: 3px solid #4ec9b0;
            margin: 0.5em 0;
            padding-left: 1em;
            color: #aaa;
        }

        /* 拖放提示區域 */
        .chat-input-area.drag-over {
            border: 2px dashed #e0a800;
            background: rgba(15, 76, 92, 0.3);
            transition: border 0.2s, background 0.2s;
        }
        .chat-input-area .drag-hint {
            position: absolute;
            top: 0; left: 0; right: 0; bottom: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(30,30,30,0.85);
            color: #4ec9b0;
            font-size: 1.2rem;
            font-weight: bold;
            border-radius: 12px;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s;
            z-index: 10;
        }
        .chat-input-area.drag-over .drag-hint {
            opacity: 1;
        }

/* 附件縮圖預覽 */
.attachments-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.attachment-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(78,201,176,0.35);
    border-radius: 12px;
    padding: 6px 8px;
    max-width: 280px;
}
.attachment-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    flex-shrink: 0;
    background: #000;
}
.attachment-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}
.attachment-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.attachment-name {
    font-size: 0.78rem;
    color: #eaeaea;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.attachment-status {
    font-size: 0.7rem;
    color: #8a8a8a;
    margin-top: 2px;
}
.remove-attach {
    background: rgba(255,255,255,0.08);
    border: none;
    color: #f48771;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
    flex-shrink: 0;
}
.remove-attach:hover {
    background: rgba(244,135,113,0.2);
}

/* 工作中指示器 - 3D 侍女工作場景 */
.working-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(20, 27, 32, 0.92);
    border: 1px solid rgba(78, 201, 176, 0.45);
    border-radius: 24px;
    margin-bottom: 8px;
    min-height: 100px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(110, 242, 255, 0.08), 0 0 12px rgba(78, 201, 176, 0.14);
}
.working-indicator::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 25px;
    padding: 2px;
    background: conic-gradient(from 0deg,
        rgba(78, 201, 176, 0) 0deg,
        rgba(110, 242, 255, 0.96) 42deg,
        rgba(118, 255, 221, 0.9) 85deg,
        rgba(78, 201, 176, 0.38) 150deg,
        rgba(78, 201, 176, 0) 220deg,
        rgba(110, 242, 255, 0.92) 280deg,
        rgba(78, 201, 176, 0) 360deg);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    pointer-events: none;
}
.working-indicator::after {
    content: "";
    position: absolute;
    width: 11px;
    height: 11px;
    top: 1px;
    left: 1px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #ffffff 0%, #9af4ff 20%, #66f0cf 48%, rgba(78, 201, 176, 0.18) 100%);
    box-shadow: 0 0 12px rgba(110, 242, 255, 0.9), 0 0 20px rgba(78, 201, 176, 0.9);
    animation: beadBorderWalk 5.6s linear infinite;
    pointer-events: none;
}
.working-indicator .working-text {
    color: #4ec9b0;
    font-size: 0.85rem;
    font-weight: bold;
    z-index: 2;
}

@keyframes beadBorderWalk {
    0% {
        top: 1px;
        left: 1px;
        transform: scale(0.9);
        opacity: 0.7;
    }
    23% {
        top: 1px;
        left: calc(100% - 12px);
        transform: scale(1.1);
        opacity: 1;
    }
    27% {
        top: 1px;
        left: calc(100% - 12px);
        transform: scale(0.95);
        opacity: 0.9;
    }
    50% {
        top: calc(100% - 12px);
        left: calc(100% - 12px);
        transform: scale(1.2);
        opacity: 1;
    }
    73% {
        top: calc(100% - 12px);
        left: 1px;
        transform: scale(0.95);
        opacity: 0.9;
    }
    77% {
        top: calc(100% - 12px);
        left: 1px;
        transform: scale(1.15);
        opacity: 1;
    }
    100% {
        top: 1px;
        left: 1px;
        transform: scale(0.9);
        opacity: 0.7;
    }
}

/* === 3D 迷你工作場景 === */
.work-scene {
    width: 120px;
    height: 72px;
    position: relative;
    perspective: 200px;
    transform-style: preserve-3d;
}

/* 桌子 - 等角透視 */
.work-desk {
    position: absolute;
    bottom: 0;
    left: 5px;
    width: 110px;
    height: 16px;
    background: linear-gradient(180deg, #7a4a32 0%, #4a2818 100%);
    border-radius: 2px;
    transform: rotateX(40deg);
    transform-origin: bottom center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

/* 螢幕 */
.work-monitor {
    position: absolute;
    bottom: 14px;
    left: 32px;
    width: 48px;
    height: 30px;
    background: #2d2d30;
    border: 2px solid #3e3e42;
    border-radius: 3px 3px 0 0;
}
.work-screen {
    position: absolute;
    inset: 2px;
    background: #1a3a5c;
    border-radius: 1px;
    animation: screenGlow 2.5s ease-in-out infinite;
}
.work-screen-stand {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 8px;
    background: #3e3e42;
    border-radius: 0 0 2px 2px;
}

/* 角色 */
.work-character {
    position: absolute;
    bottom: 14px;
    left: 8px;
    width: 22px;
    height: 30px;
}
.work-body-torso {
    position: absolute;
    bottom: 0;
    left: 4px;
    width: 14px;
    height: 16px;
    background: #4ec9b0;
    border-radius: 4px 4px 0 0;
}
.work-head {
    position: absolute;
    bottom: 15px;
    left: 2px;
    width: 18px;
    height: 18px;
    font-size: 15px;
    line-height: 18px;
    text-align: center;
    animation: headBob 0.8s ease-in-out infinite;
}

/* 手臂 - 打字動畫 */
.work-arm {
    position: absolute;
    width: 3px;
    height: 10px;
    background: #3daa90;
    border-radius: 1px;
    bottom: 10px;
    transform-origin: top center;
    animation: armType 0.25s ease-in-out infinite alternate;
}
.work-arm-l {
    left: 0;
    animation-delay: 0s;
}
.work-arm-r {
    right: 0;
    animation-delay: 0.12s;
}

/* 咖啡 */
.work-coffee {
    position: absolute;
    bottom: 16px;
    right: 8px;
    font-size: 10px;
    opacity: 0.7;
    animation: steamRise 2s ease-in-out infinite;
}

/* === 動畫關鍵幀 === */
@keyframes headBob {
    0%, 100% { transform: translateY(0); }
    40% { transform: translateY(-3px); }
    60% { transform: translateY(-1px); }
}

@keyframes armType {
    0% { transform: rotate(0deg) translateY(0); }
    100% { transform: rotate(-20deg) translateY(-3px); }
}

@keyframes screenGlow {
    0%, 100% { box-shadow: inset 0 0 4px rgba(78,201,176,0.3); }
    50% { box-shadow: inset 0 0 8px rgba(78,201,176,0.7); }
}

@keyframes steamRise {
    0%, 100% { transform: translateY(0); opacity: 0.7; }
    50% { transform: translateY(-4px); opacity: 1; }
}

/* === 水波特效（OXXO clip-path 技法）｜工作中指示器 === */
.work-wave,
.work-wave::before,
.work-wave::after {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 24px;
    pointer-events: none;
    clip-path: ellipse(0 0 at 50% 50%);
    will-change: clip-path, opacity;
}
.work-wave {
    z-index: 0;
    background: radial-gradient(circle at 50% 50%, rgba(110,242,255,0.55) 0%, rgba(78,201,176,0.12) 55%, rgba(78,201,176,0) 72%);
    animation: workWave1 4s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
}
.work-wave::before {
    content: "";
    background: radial-gradient(circle at 50% 50%, rgba(118,255,221,0.5) 0%, rgba(78,201,176,0.10) 55%, rgba(78,201,176,0) 72%);
    animation: workWave2 4s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
}
.work-wave::after {
    content: "";
    background: radial-gradient(circle at 50% 50%, rgba(110,242,255,0.45) 0%, rgba(78,201,176,0.08) 55%, rgba(78,201,176,0) 72%);
    animation: workWave3 4s cubic-bezier(0.25, 0.1, 0.25, 1) infinite;
}
@keyframes workWave1 {
    0%   { clip-path: ellipse(0 0 at 50% 50%); opacity: 0.5; }
    70%  { opacity: 0.15; }
    100% { clip-path: ellipse(160% 160% at 50% 50%); opacity: 0; }
}
@keyframes workWave2 {
    0%, 12% { clip-path: ellipse(0 0 at 50% 50%); opacity: 0.5; }
    82%     { opacity: 0.15; }
    100%    { clip-path: ellipse(160% 160% at 50% 50%); opacity: 0; }
}
@keyframes workWave3 {
    0%, 24% { clip-path: ellipse(0 0 at 50% 50%); opacity: 0.5; }
    94%     { opacity: 0.15; }
    100%    { clip-path: ellipse(160% 160% at 50% 50%); opacity: 0; }
}

/* 編輯器區域（覆蓋顯示） */
#editor-area {
    display: none;
    flex-direction: column;
    border-top: 1px solid #3e3e42;
    background: #1e1e1e;
    min-height: 120px;
    flex-shrink: 0;
}
#editor-area #file-editor {
    min-height: 200px;
    flex: 1;
}
/* Monaco Editor 覆蓋樣式 */
#editor-area .monaco-editor {
    border-radius: 0 0 8px 8px;
}


/* ---------- 右下角 柔和閃爍提示 (2x2 光點) ---------- */
        #chatInputWrapper {
            position: relative;
        }

        #chatInputWrapper::after {
            content: "";
            position: absolute;
            bottom: 2px;
            right: 2px;
            width: 2px;
            height: 2px;
            border-radius: 50%;
            background: rgba(140, 210, 255, 0.6);
            box-shadow: 0 0 4px 2px rgba(140, 210, 255, 0.3);
            pointer-events: none;
            z-index: 10;
            animation: cornerGlowPulse 2.8s ease-in-out infinite;
        }

        @keyframes cornerGlowPulse {
            0%, 100% {
                opacity: 0.12;
                box-shadow: 0 0 2px 1px rgba(140, 210, 255, 0.08);
            }
            50% {
                opacity: 0.85;
                box-shadow: 0 0 6px 3px rgba(140, 210, 255, 0.4);
            }
        }




/* 快速跳轉對話 */
.btnBox {
    position: relative;  /* 為下拉列表定位基準 */
}
.jump-dropdown {
    position: absolute;
    bottom: 100%;         /* 顯示在按鈕上方 */
    right: 0;
    max-height: 90vh;
    overflow-y: auto;
    background: #2d2d30;
    border: 1px solid #4ec9b0;
    border-radius: 8px;
    padding: 6px 0;
    min-width: 180px;
    z-index: 999;
    opacity: .8;
}
.jump-dropdown .jump-item {
    padding: 6px 12px;
    cursor: pointer;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
}
.jump-dropdown .jump-item:hover {
    background: #0f4c5c;
    color: white;
}
@media (min-width: 769px) {
.mobile-menu-toggle,#toggleToolsPanel,#mobileStopBtn{display: none;}
.crystal-plate{display: contents;}

/* 🌸 Agent 資訊按鈕 - 動畫 */
.agent-info-btn {
    background: none;
    border: 2px solid #4ec9b0;
    color: #4ec9b0;
    font-size: 1.2rem;
    padding: 2px 6px;
    cursor: pointer;
    border-radius: 50%;
    margin-right: 6px;
    animation: agentPulse 2s ease-in-out infinite;
    transition: all 0.3s;
    line-height: 1;
}
.agent-info-btn:hover {
    background: #4ec9b0;
    color: #1e1e1e;
    box-shadow: 0 0 16px #4ec9b080;
    animation: agentSpin 0.6s ease-in-out;
}
@keyframes agentPulse {
    0%,100% { box-shadow: 0 0 4px #4ec9b040; transform: scale(1); }
    50% { box-shadow: 0 0 14px #4ec9b0a0; transform: scale(1.08); }
}
@keyframes agentSpin {
    0% { transform: rotate(0deg) scale(1); }
    100% { transform: rotate(360deg) scale(1.1); }
}

/* Agent 資訊面板 - tab 按鈕 */
.agent-tab-btn {
    background: none;
    border: 1px solid #3e3e42;
    color: #ccc;
    padding: 4px 12px;
    cursor: pointer;
    border-radius: 14px;
    font-size: 0.78rem;
    font-family: inherit;
    transition: all 0.2s;
}
.agent-tab-btn.active {
    background: #4ec9b0;
    color: #1e1e1e;
    border-color: #4ec9b0;
}
.agent-tab-btn:hover:not(.active) {
    border-color: #4ec9b080;
    color: #4ec9b0;
}
}



/*日誌容器的樣式*/
#logContainer {
    font-size: 0.8rem;
    line-height: 1.4;
}
#logContainer .log-out { color: #69db7c; }
#logContainer .log-err { color: #ff6b6b; }
#logContainer .log-info { color: #d4d4d4; }







/* ===== 建立 Agent 模態框 ===== */
.create-agent-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}
.create-agent-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.65);
}
.create-agent-dialog {
    position: relative;
    background: #1e1e1e;
    border: 1px solid #4ec9b0;
    border-radius: 12px;
    width: 520px;
    max-width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    z-index: 1;
}
.create-agent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #333;
}
.create-agent-header h3 {
    margin: 0;
    color: #4ec9b0;
    font-size: 1.2rem;
}
.create-agent-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.create-agent-close:hover {
    color: #fff;
    background: #444;
}
.create-agent-body {
    padding: 16px 20px;
}
.create-agent-field {
    margin-bottom: 14px;
}
.create-agent-field label {
    display: block;
    color: #ccc;
    font-size: 0.95rem;
    margin-bottom: 6px;
    font-weight: bold;
}
.create-agent-field .role-hint {
    font-weight: normal;
    color: #888;
    font-size: 0.8rem;
}
.create-agent-field input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.95rem;
    box-sizing: border-box;
}
.create-agent-field input[type="text"]:focus {
    border-color: #4ec9b0;
    outline: none;
}
.role-search-box {
    margin-bottom: 6px;
}
.role-search-box input {
    width: 100%;
    padding: 8px 10px;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.85rem;
    box-sizing: border-box;
}
.role-search-box input:focus {
    border-color: #4ec9b0;
    outline: none;
}
.role-select-wrapper select {
    width: 100%;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 0.85rem;
    padding: 4px;
    box-sizing: border-box;
}
.role-select-wrapper select option,
.role-select-wrapper select optgroup {
    background: #2d2d2d;
    color: #e0e0e0;
    padding: 4px 8px;
}
.role-select-wrapper select optgroup {
    font-weight: bold;
    color: #4ec9b0;
}
.role-loading {
    text-align: center;
    color: #888;
    padding: 12px;
}
.role-info {
    margin-top: 8px;
    padding: 8px 12px;
    background: #1a3a2a;
    border: 1px solid #4ec9b0;
    border-radius: 6px;
    color: #4ec9b0;
    font-size: 0.85rem;
}
.create-agent-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #333;
}
.btn-cancel {
    padding: 8px 16px;
    background: #444;
    border: 1px solid #555;
    border-radius: 6px;
    color: #ccc;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-cancel:hover {
    background: #555;
}
.btn-confirm {
    padding: 8px 20px;
    background: #4ec9b0;
    border: none;
    border-radius: 6px;
    color: #1e1e1e;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
}
.btn-confirm:hover {
    background: #5fd9c0;
}
.btn-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
#createQiBtn {
    background: linear-gradient(135deg, #4ec9b0, #2d8a7a);
    border: 1px solid #4ec9b0;
    color: #1e1e1e;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}
#createQiBtn:hover {
    background: linear-gradient(135deg, #5fd9c0, #3daa98);
}

/* ===== 工具輸出摺疊細線 ===== */
.tool-summary {
    cursor: pointer;
    height: 2px;
    line-height: 2px;
    overflow: hidden;
    background: linear-gradient(90deg, #2e2e2e 0%, #3a3a3a 60%, #2e2e2e 100%);
    border-radius: 1px;
    transition: all 0.35s ease;
    opacity: 0.5;
    list-style: none;
    margin: 2px 0;
}
.tool-summary::-webkit-details-marker { display: none; }
.tool-summary::marker { display: none; content: ''; }
.tool-summary:hover {
    opacity: 0.85;
    height: auto;
    line-height: 1.5;
    padding: 4px 10px;
    font-size: 0.75rem;
    color: #888;
    background: #2a2a2a;
    border-radius: 4px;
    margin: 3px 0;
}
.tool-summary:hover::before {
    content: '🔧 工具執行過程 ──────';
    color: #777;
}
.tool-collapse[open] > .tool-summary {
    height: auto;
    line-height: 1.5;
    padding: 4px 10px;
    font-size: 0.75rem;
    color: #999;
    background: #2a2a2a;
    border-radius: 4px 4px 0 0;
    opacity: 0.8;
    margin: 0;
}
.tool-collapse[open] > .tool-summary::before {
    content: '🔧 工具執行過程 ──────';
    color: #777;
}

/* ===== 思考過程摺疊框 ===== */
.think-fold {
    border: 1px solid #2e2e24 !important;
    border-radius: 6px;
    background: #1a1a14 !important;
}
.think-fold > summary {
    color: #a09060 !important;
    background: #22221c !important;
    transition: all 0.3s;
}
.think-fold > summary:hover {
    color: #c0b080 !important;
    background: #282820 !important;
}
.think-fold .think-container {
    background: #1a1a14 !important;
    border-radius: 0 !important;
    border-left: none !important;
    margin-bottom: 0 !important;
}
.think-fold .think-content {
    font-size: 0.85rem;
    line-height: 1.5;
    color: #b0a080;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== 全局滾動條樣式 ===== */
::-webkit-scrollbar {
    width: 2px;
    background: rgb(0, 0, 0, 0);
    animation: cornerGlowPulse 3.1s ease-in-out infinite;
}
::-webkit-scrollbar-track {
    background: rgb(0, 0, 0, 0);
}
::-webkit-scrollbar-thumb {
    background: rgba(212, 212, 212, 0.15);
    border-radius: 1px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 212, 212, 0.3);
}

/* 側邊欄滾動條 - 不同秒數營造隨機感 */
.agent-sidebar::-webkit-scrollbar {
    animation: cornerGlowPulse 2.4s ease-in-out infinite;
}
/* 聊天區滾動條 */
.chat-area::-webkit-scrollbar {
    animation: cornerGlowPulse 3.8s ease-in-out infinite;
}
/* 對話列表滾動條 */
.conversation-list::-webkit-scrollbar {
    animation: cornerGlowPulse 2.9s ease-in-out infinite;
}
/* 訊息區滾動條 */
.messages-container::-webkit-scrollbar {
    animation: cornerGlowPulse 3.5s ease-in-out infinite;
}
/* 彈窗/模態框滾動條 */
.modal-content::-webkit-scrollbar,
.tool-result::-webkit-scrollbar,
.think-fold::-webkit-scrollbar {
    animation: cornerGlowPulse 2.7s ease-in-out infinite;
}

/* Firefox 滾動條 */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 212, 212, 0.15) transparent;
}

/* =========================================================== */
/* === 重啟警告動畫系統 | idx | 202607290024 === */
/* =========================================================== */

/* -- 左側面板脈衝紅光 -- */
.agent-sidebar.restart-warning {
    animation: restartSidebarPulse 1.2s ease-in-out infinite;
}
@keyframes restartSidebarPulse {
    0%, 100% { box-shadow: inset 0 0 0px rgba(255,60,60,0); }
    50% { box-shadow: inset 0 0 50px rgba(255,60,60,0.35), 0 0 25px rgba(255,60,60,0.25); }
}

/* -- 頭像區 Avatar 紅色脈衝光環 -- */
.agent-item.restart-warning {
    animation: avatarGlow 0.7s ease-in-out infinite !important;
    border: 2px solid #ff3b3b !important;
    position: relative;
    overflow: visible !important;
}
.agent-item.restart-warning::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 12px;
    background: transparent;
    border: 2px solid rgba(255,60,60,0.6);
    animation: avatarRing 0.7s ease-in-out infinite;
    pointer-events: none;
}
@keyframes avatarGlow {
    0%, 100% { background: #2d2d30; box-shadow: 0 0 6px rgba(255,60,60,0.3); }
    50% { background: #3d1818; box-shadow: 0 0 22px rgba(255,60,60,0.7), 0 0 45px rgba(255,80,80,0.35); }
}
@keyframes avatarRing {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.04); }
}

/* -- 對話區警告對話框 -- */
.message.restart-dialog {
    background: linear-gradient(135deg, #2d1010 0%, #1a0808 100%) !important;
    border: 2px solid #ff3b3b !important;
    animation: restartDialogShake 0.4s ease-in-out infinite, restartDialogGlow 1.2s ease-in-out infinite;
    position: relative;
    overflow: visible !important;
    border-radius: 16px !important;
}
@keyframes restartDialogShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}
@keyframes restartDialogGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(255,60,60,0.3); }
    50% { box-shadow: 0 0 35px rgba(255,60,60,0.7), 0 0 70px rgba(255,80,80,0.35); }
}

/* -- 對話框內部警告圖標彈跳 -- */
.restart-dialog .restart-icon {
    display: inline-block;
    animation: restartIconBounce 0.5s ease-in-out infinite;
    font-size: 1.6rem;
}
@keyframes restartIconBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* -- 重啟指令文字閃爍 -- */
.restart-dialog .restart-text {
    animation: restartTextBlink 0.8s ease-in-out infinite;
    color: #ff5c5c;
    font-weight: bold;
    font-size: 1.1rem;
}
@keyframes restartTextBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* -- 關閉警告按鈕 -- */
.restart-dialog .restart-dismiss-btn {
    position: absolute;
    top: 6px;
    right: 10px;
    background: rgba(255,60,60,0.2);
    color: #ff9999;
    border: 1px solid #ff3b3b;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 22px;
    text-align: center;
    z-index: 2;
    transition: background 0.2s;
}

/* ══════════════════════════════════════════════════════════════
   樣式8：手勢隱藏 + 浮動鍵（沉浸式）by indexPage
   向下滾動 → 輸入列自動收合，只留懸浮喚回圓鈕；向上滾動或點鈕 → 喚回
   ══════════════════════════════════════════════════════════════ */
#floatInputBtn { display: none; }

/* ══════════════════════════════════════════════════════════════
   樣式8 桌機版延伸：手勢隱藏 + 浮動鍵（沉浸式）by indexPage 2026-10-03
   電腦版比照手機版：向下滾動 → 輸入列自動收合，只留懸浮 ⌨️ 圓鈕；
   向上滾動、回到最新、或點圓鈕 → 喚回輸入列。
   浮動鍵由 main.js 掛載於 .chat-main 內，故桌機以 absolute 對齊聊天欄右下角
   （不會壓到右側工具面板）。
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 769px) {
    .chat-main { position: relative; }
    .chat-input-area {
        max-height: 560px;
        transition: max-height .2s ease, padding .2s ease, margin .2s ease,
                    opacity .18s ease, transform .2s ease;
    }
    body.scrolling .chat-input-area {
        max-height: 0 !important;
        overflow: hidden;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
        border-width: 0 !important;
        opacity: 0;
        transform: translateY(10px);
        pointer-events: none;
    }
    #floatInputBtn {
        position: absolute;
        right: 16px;
        bottom: 16px;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: linear-gradient(135deg, #4ec9b0, #2aa88f);
        border: none;
        color: #0f1f1c;
        font-size: 1.4rem;
        box-shadow: 0 6px 20px rgba(0,0,0,.5), 0 0 0 1px rgba(78,201,176,.35);
        display: none;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 400;
        touch-action: manipulation;
    }
    body.scrolling #floatInputBtn {
        display: inline-flex;
        animation: floatInD .25s ease;
    }
    @keyframes floatInD {
        from { transform: translateY(16px) scale(.8); opacity: 0; }
        to   { transform: translateY(0) scale(1); opacity: 1; }
    }
}
@media (max-width: 768px) {
    .chat-input-area {
        max-height: 560px;
        transition: max-height .2s ease, padding .2s ease, margin .2s ease,
                    opacity .18s ease, transform .2s ease;
    }
    body.scrolling .chat-input-area {
        max-height: 0 !important;
        overflow: hidden;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
        border-width: 0 !important;
        opacity: 0;
        transform: translateY(10px);
        pointer-events: none;
    }
    #floatInputBtn {
        position: fixed;
        right: 14px;
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
        width: 52px;
        height: 52px;
        border-radius: 50%;
        background: linear-gradient(135deg, #4ec9b0, #2aa88f);
        border: none;
        color: #0f1f1c;
        font-size: 1.5rem;
        box-shadow: 0 6px 20px rgba(0,0,0,.5), 0 0 0 1px rgba(78,201,176,.35);
        display: none;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 400;
        touch-action: manipulation;
    }
    body.scrolling #floatInputBtn {
        display: inline-flex;
        animation: floatIn .25s ease;
    }
    @keyframes floatIn {
        from { transform: translateY(16px) scale(.8); opacity: 0; }
        to   { transform: translateY(0) scale(1); opacity: 1; }
    }
}
.restart-dialog .restart-dismiss-btn:hover {
    background: rgba(255,60,60,0.5);
    color: #fff;
}
/* =========================================================== */


/* ===== 錄音鍵（對話框）===== */
.btnBox button#recordBtn.recording {
    background: linear-gradient(135deg, #e05561, #c0363f) !important;
    color: #fff !important;
    animation: recordPulse 1.2s ease-in-out infinite;
}
@keyframes recordPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(224, 85, 97, 0.55); }
    50% { box-shadow: 0 0 0 12px rgba(224, 85, 97, 0); }
}

/* =========================================================== */
/* ===== 🔠 放大字體（水晶盤按鈕）===== */
body.font-lg #chatMessages .message-bubble,
body.font-lg #chatMessages .message-bubble p,
body.font-lg #chatMessages .message-bubble li,
body.font-lg #chatMessages .message-bubble div {
    font-size: 1.2rem !important;
    line-height: 1.65 !important;
}
body.font-lg #chatMessages .message-bubble pre,
body.font-lg #chatMessages .message-bubble code,
body.font-lg #chatMessages .message-bubble pre code {
    font-size: 1.05rem !important;
}
body.font-lg #chatMessages .think-content,
body.font-lg #chatMessages #think-content {
    font-size: 1.05rem !important;
}
body.font-lg #chatMessages .message-meta {
    font-size: 0.85rem !important;
}
body.font-lg #chatMessages .message-bubble h1,
body.font-lg #chatMessages .message-bubble h2,
body.font-lg #chatMessages .message-bubble h3 {
    font-size: 1.4em !important;
}

body.font-xl #chatMessages .message-bubble,
body.font-xl #chatMessages .message-bubble p,
body.font-xl #chatMessages .message-bubble li,
body.font-xl #chatMessages .message-bubble div {
    font-size: 1.4rem !important;
    line-height: 1.7 !important;
}
body.font-xl #chatMessages .message-bubble pre,
body.font-xl #chatMessages .message-bubble code,
body.font-xl #chatMessages .message-bubble pre code {
    font-size: 1.2rem !important;
}
body.font-xl #chatMessages .think-content,
body.font-xl #chatMessages #think-content {
    font-size: 1.2rem !important;
}
body.font-xl #chatMessages .message-meta {
    font-size: 0.95rem !important;
}
body.font-xl #chatMessages .message-bubble h1,
body.font-xl #chatMessages .message-bubble h2,
body.font-xl #chatMessages .message-bubble h3 {
    font-size: 1.6em !important;
}

/* ===== 放大字體：Agent 回覆（round-reply-text / 流式 reply-content）===== */
body.font-lg #chatMessages .round-reply-text,
body.font-lg #chatMessages .round-reply-text p,
body.font-lg #chatMessages .round-reply-text li,
body.font-lg #chatMessages .round-reply-text div,
body.font-lg #chatMessages #reply-content {
    font-size: 1.2rem !important;
    line-height: 1.65 !important;
}
body.font-lg #chatMessages .round-reply-text pre,
body.font-lg #chatMessages .round-reply-text code,
body.font-lg #chatMessages .round-reply-text pre code {
    font-size: 1.05rem !important;
}
body.font-xl #chatMessages .round-reply-text,
body.font-xl #chatMessages .round-reply-text p,
body.font-xl #chatMessages .round-reply-text li,
body.font-xl #chatMessages .round-reply-text div,
body.font-xl #chatMessages #reply-content {
    font-size: 1.4rem !important;
    line-height: 1.7 !important;
}
body.font-xl #chatMessages .round-reply-text pre,
body.font-xl #chatMessages .round-reply-text code,
body.font-xl #chatMessages .round-reply-text pre code {
    font-size: 1.2rem !important;
}

/* ══════════ indexPage：標頭按鈕摺疊(收藏) + 未讀標示 ══════════ */
.chat-header { position: relative; }
.agent-header-btns {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    overflow: hidden;
    flex-shrink: 1;
}
.agent-header-btns button {
    flex-shrink: 0;
    white-space: nowrap;
}
/* 未讀按鈕：啟用中（已標記未讀） */
#unreadBtn.header-tool-btn.on {
    background: #c0392b !important;
    box-shadow: 0 0 8px rgba(192,57,43,.6);
}
/* 摺疊時隱藏的按鈕 */
.agent-header-btns button.header-folded {
    display: none !important;
}
.header-more-btn { flex-shrink: 0; }
/* 更多按鈕下拉面板（手機版摺疊收藏） */
.header-btns-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 8px;
    background: #2d2d30;
    border: 1px solid #3e3e42;
    border-radius: 12px;
    padding: 6px;
    z-index: 9999;
    min-width: 160px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0,0,0,.45);
    display: none;
}
.header-btns-dropdown.open { display: block !important; }
.header-btns-dropdown .header-dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #ddd;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
}
.header-btns-dropdown .header-dropdown-item:hover { background: rgba(255,255,255,.08); }
/* 左側名片未讀標示 */
.agent-item.has-unread {
    position: relative;
    box-shadow: inset 0 0 0 1px rgba(224,85,97,.45);
}
.agent-item .agent-unread-badge {
    display: inline-block;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 7.5em;
    margin-left: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    background: #e05561;
    color: #fff;
    font-size: 0.6rem;
    line-height: 1.3;
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.35);
    z-index: 3;
    box-shadow: 0 2px 6px rgba(224,85,97,.5);
    cursor: pointer;
}
.agent-item .agent-unread-badge:hover { filter: brightness(1.15); }

/* ===== 便條輸入框（未讀便條）· idx 2026-09-23 ===== */
.unread-note-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.unread-note-box {
    width: min(92vw, 380px);
    background: #2d2d30;
    border: 1px solid #4a4a4f;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,.6);
    color: #ddd;
}
.unread-note-head { font-size: 0.95rem; margin-bottom: 8px; }
.unread-note-input {
    width: 100%;
    box-sizing: border-box;
    background: #1e1e20;
    color: #eee;
    border: 1px solid #4a4a4f;
    border-radius: 8px;
    padding: 8px;
    font-size: 0.9rem;
    min-height: 72px;
    resize: vertical;
    outline: none;
}
.unread-note-input:focus { border-color: #8a6d9c; }
.unread-note-foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.unread-note-hint { font-size: 0.68rem; color: #8a8a90; margin-right: auto; }
.unread-note-btn {
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    background: #3a3a3f;
    color: #ddd;
}
.unread-note-btn:hover { filter: brightness(1.15); }
.unread-note-save { background: #8a6d9c; color: #fff; }
.unread-note-clear { background: #7a3a3f; color: #fff; }
@media (max-width: 768px) {
    .agent-item .agent-unread-badge { max-width: 5.2em; }
}
@media (max-width: 768px) {
    .agent-header-btns { max-width: 45vw; }
    .header-btns-dropdown { right: 4px; left: auto; }
}

/* ===== 「更多」＝會員面板 · idx 2026-09-20
   結構：src="/member" 會籍鍵 → Token 餘額 → 完成提示鍵 → 空行 → 緊急重啟鍵 →（手機摺疊鍵） */
.header-more-btn {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.header-more-btn.has-fold #headerMemberName::after { content: ' ⋯'; }
.header-more-static { display: flex; flex-direction: column; }
.header-btns-dropdown .header-member-name {
    padding: 4px 12px 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    font-size: 0.82rem;
    font-weight: 700;
    color: #c084fc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* ★ 2026-09-21：會籍鍵下方的 Token 餘額 */
.header-btns-dropdown .header-token-balance {
    padding: 2px 12px 8px;
    font-size: 0.78rem;
    color: #7aa2ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.header-dropdown-gap { height: 10px; }
.header-btns-dropdown .notify-toggle-btn { text-align: center; }
.header-btns-dropdown .header-more-static #stopBtn {
    display: block;
    width: 100%;
    margin: 0;
    padding: 8px 12px;
    text-align: center;
    border-radius: 10px;
    font-size: 0.85rem;
}
.header-btns-dropdown .header-fold-items:not(:empty) {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,.08);
}

/* ===== 會員浮動面板（src="/member"）· idx 2026-09-20 ===== */
.member-panel-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 520px;
    height: 560px;
    min-width: 300px;
    min-height: 260px;
    background: #1e1e1e;
    border: 2px solid #c084fc;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    resize: both;
    overflow: hidden;
}
.member-panel-float .member-content { flex: 1; overflow: hidden; }
#closeMemberPanel {
    background: none;
    border: none;
    color: #f48771;
    font-size: 1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
#closeMemberPanel:hover { background: #f4877133; }
@media (max-width: 768px) {
    .member-panel-float {
        width: 92vw !important;
        height: 72vh !important;
        bottom: 2vh !important;
        right: 4vw !important;
    }
}

/* ===== Markdown 內容樣式（by indexPage 2026-09-18）===== */
.md-body { line-height: 1.55; white-space: normal; word-break: break-word; }
.md-body > *:first-child { margin-top: 0 !important; }
.md-body > *:last-child { margin-bottom: 0 !important; }
.md-body p { margin: 0.5em 0; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { margin: 0.7em 0 0.4em; color: #4ec9b0; line-height: 1.3; }
.md-body h1 { font-size: 1.35em; border-bottom: 1px solid #3e3e42; padding-bottom: 0.2em; }
.md-body h2 { font-size: 1.2em; border-bottom: 1px solid #3e3e42; padding-bottom: 0.15em; }
.md-body h3 { font-size: 1.08em; }
.md-body ul, .md-body ol { margin: 0.5em 0; padding-left: 1.4em; }
.md-body li { margin: 0.2em 0; }
.md-body strong { color: #ffd479; font-weight: 700; }
.md-body em { color: #d7ba7d; }
.md-body a { color: #4fc3f7; }
.md-body code { background: #2d2d30; padding: 2px 6px; border-radius: 4px; font-family: "Cascadia Code", "Courier New", monospace; font-size: 0.88em; }
.md-body pre { background: #1e1e1e; padding: 10px; border-radius: 8px; overflow-x: auto; }
.md-body pre code { background: transparent; padding: 0; }
.md-body blockquote { border-left: 3px solid #4ec9b0; margin: 0.5em 0; padding: 0.1em 0 0.1em 1em; color: #b0b0b0; }
.md-body table { border-collapse: collapse; margin: 0.6em 0; font-size: 0.9em; }
.md-body th, .md-body td { border: 1px solid #4a4a50; padding: 4px 10px; text-align: left; }
.md-body th { background: #33333a; color: #4ec9b0; }
.md-body tr:nth-child(even) td { background: #26262a; }
.md-body hr { border: none; border-top: 1px solid #4a4a50; margin: 0.8em 0; }
.md-body img { max-width: 100%; height: auto; display: block; border-radius: 8px; margin: 0.5em 0; }
.md-body video { max-width: 100%; height: auto; border-radius: 8px; margin: 0.5em 0; }

/* ---------- 快捷問題列（每 agent 3 條） by 病毒引擎 20261001 ---------- */
.quick-questions-bar{
    display:flex; flex-wrap:wrap; gap:6px; align-items:center;
    padding:6px 10px 2px 10px; margin:0 0 2px 0;
    animation:qqFade .18s ease-out;
}
.quick-questions-bar .qq-lead{ font-size:12px; opacity:.7; margin-right:2px; }
.quick-questions-bar .qq-chip{
    display:inline-flex; align-items:center;
    font-size:12px; line-height:1.35; color:#cfe9ff;
    background:rgba(78,201,176,.10);
    border:1px solid rgba(78,201,176,.35);
    border-radius:14px; padding:5px 11px; cursor:pointer;
    white-space:nowrap; max-width:100%; overflow:hidden; text-overflow:ellipsis;
    transition:background .15s, border-color .15s, transform .1s, box-shadow .15s;
}
.quick-questions-bar .qq-chip:hover{
    background:rgba(78,201,176,.22); border-color:rgba(78,201,176,.75);
    box-shadow:0 0 8px rgba(78,201,176,.25);
}
.quick-questions-bar .qq-chip:active{ transform:scale(.97); }
@keyframes qqFade{ from{opacity:0; transform:translateY(4px);} to{opacity:1; transform:none;} }
@media (max-width:600px){
    .quick-questions-bar{ flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; padding-bottom:4px; }
    .quick-questions-bar .qq-chip{ flex:0 0 auto; }
}


/* ===== 插話氣泡（indexPage 20261008｜原因：工作中補充的訊息與一般訊息長得一樣，看不出是插話）===== */
.message.interject-note { align-self: flex-end; opacity: 1 !important; }
.message.interject-note .message-bubble {
    background: #2b2136 !important;
    border: 1px dashed #c78bff !important;
    border-radius: 14px !important;
    opacity: 1 !important;
    word-break: break-word;
}
.message.interject-note .message-bubble .interject-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: #e3b6ff;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.message.interject-note .message-meta { color: #b992d6; }

/* ===== L3 結構化媒體卡片（20261008 indexPage）
   統一渲染工具/助手回傳的圖、影、音；各前端共用同一份 media 資料 ===== */
.mok-media-wrap{display:flex;flex-wrap:wrap;gap:10px;padding:8px 12px;}
.mok-media{border:1px solid #3e3e42;border-radius:10px;overflow:hidden;background:#1a1a1d;max-width:100%;}
.mok-media-image img{display:block;max-width:min(420px,100%);max-height:420px;object-fit:contain;background:#111;cursor:zoom-in;}
.mok-media-video video{display:block;max-width:min(520px,100%);max-height:420px;background:#000;}
.mok-media-audio{display:flex;align-items:center;gap:8px;padding:6px 10px;}
.mok-media-audio audio{height:34px;max-width:320px;}
.mok-media-ico{font-size:1.1rem;}
.mok-media-cap{padding:6px 10px;font-size:0.78rem;color:#b0b0b0;word-break:break-word;}

/* ===== 頂端會員 Token 能量條 · idx 2026-10-09 (HK) =====
   寬度＝Token 剩餘額度百分比；健康度分級：
   >=80% 綠 5px ｜ >=50% 黃 10px ｜ >=10% 橙 15px ｜ <10% 紅 20px 柔和慢閃。
   純顯示層：pointer-events:none，不攔任何點擊、不改任何既有規則。 ===== */
.token-energy-bar{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 20px;
    z-index: 2147483000;
    pointer-events: none;
    background: transparent;
    opacity: 0;
    transition: opacity .6s ease;
}
.token-energy-bar.is-on{ opacity: 1; }
/* idx | 血條可點→充值頁：僅 is-on 時色塊本身可點，其餘維持 pointer-events:none | 20261009 (HK) */
.token-energy-bar.is-on .token-energy-fill{ pointer-events: auto; cursor: pointer; }
.token-energy-bar.is-on .token-energy-fill:hover{ filter: brightness(1.2); }
.token-energy-fill{
    /* idx | 修正：色塊改為「由左右兩端同時向中間收縮」 | 由 JS 設定 left/right，兩端各留 (100−剩餘%)/2；圓角改全圓角藥丸形 | 20261008 1927 (HK) */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    border-radius: 999px;
    transition: left .9s cubic-bezier(.4,0,.2,1), right .9s cubic-bezier(.4,0,.2,1), height .5s ease, background .9s ease, box-shadow .9s ease;
}
.token-energy-bar.lv-ok   .token-energy-fill{ height:5px;  background:linear-gradient(90deg,rgba(63,191,127,.55),rgba(94,224,160,.85));  box-shadow:0 0 6px rgba(94,224,160,.30); }
.token-energy-bar.lv-warn .token-energy-fill{ height:10px; background:linear-gradient(90deg,rgba(216,180,92,.55),rgba(240,211,138,.85)); box-shadow:0 0 8px rgba(240,211,138,.30); }
.token-energy-bar.lv-mid  .token-energy-fill{ height:15px; background:linear-gradient(90deg,rgba(217,138,74,.55),rgba(240,171,109,.85)); box-shadow:0 0 10px rgba(240,171,109,.30); }
.token-energy-bar.lv-low  .token-energy-fill{ height:20px; background:linear-gradient(90deg,rgba(192,80,92,.45),rgba(232,139,147,.80));  box-shadow:0 0 12px rgba(232,139,147,.40); animation:tokenEnergyPulse 2.8s ease-in-out infinite; }
@keyframes tokenEnergyPulse{ 0%,100%{ opacity:.30; } 50%{ opacity:.85; } }

/* ★ 護眼模式 by idx 2026-10-10 (HK)｜低藍光暖色覆蓋層；開關＝聊天頂列 #eyeCareBtn，強度滑桿＝#eyeCareLevel；狀態存 localStorage("mok_eye_care" / "mok_eye_care_level") */
:root{ --eye-care-level:.51; }  /* 護眼強度（可調）：.10~.80，預設 .51 ＝ 比初版 .34 再暗約 50% */
#eyeCareLayer{
    position:fixed; inset:0; z-index:2147483000; pointer-events:none;
    background:#ff9f43; mix-blend-mode:multiply; opacity:0;
    transition:opacity .15s ease;
}
body.eye-care #eyeCareLayer{ opacity:var(--eye-care-level,.51); }

/* ★ 護眼強度滑桿 by idx 2026-10-10 (HK)｜僅護眼開啟時出現；拖動即時調整覆蓋層濃度（越右越暗） */
#eyeCareLevel{
    display:none; flex:0 1 74px; min-width:46px; height:16px; margin-left:2px;
    -webkit-appearance:none; appearance:none; background:transparent; cursor:pointer; vertical-align:middle;
}
body.eye-care #eyeCareLevel{ display:inline-block; }
#eyeCareLevel::-webkit-slider-runnable-track{ height:4px; border-radius:999px; background:linear-gradient(90deg,rgba(255,159,67,.20),rgba(255,159,67,.95)); }
#eyeCareLevel::-webkit-slider-thumb{ -webkit-appearance:none; width:13px; height:13px; margin-top:-4.5px; border-radius:50%; background:#ffd7a0; border:1px solid rgba(0,0,0,.4); box-shadow:0 0 6px rgba(255,170,80,.65); }
#eyeCareLevel::-moz-range-track{ height:4px; border-radius:999px; background:rgba(255,159,67,.7); }
#eyeCareLevel::-moz-range-thumb{ width:13px; height:13px; border-radius:50%; background:#ffd7a0; border:1px solid rgba(0,0,0,.4); }
@media (max-width:640px){ #eyeCareLevel{ flex-basis:56px; } }
/* ★ 護眼鍵組搬入會員框 by idx 2026-10-10 (HK)：下拉為 column 佈局，滑桿改滿寬區塊、僅護眼開啟時顯示 */ .header-btns-dropdown .header-more-static #eyeCareLevel{ width:100%; flex:0 0 auto; height:18px; margin:4px 0 2px; box-sizing:border-box; } body.eye-care .header-btns-dropdown .header-more-static #eyeCareLevel{ display:block; } #eyeCareBtn.mok-active{
    box-shadow:0 0 0 1px rgba(255,196,128,.85) inset, 0 0 8px rgba(255,170,80,.35);
}
@media (prefers-reduced-motion: reduce){
    .token-energy-bar.lv-low .token-energy-fill{ animation:none; opacity:.65; }
}
@media (max-width:640px){
  .mok-media-image img,.mok-media-video video{max-width:100%;max-height:60vh;}
}
