body { background: #0f0d14; color: #e8e4ef; font-family: 'Segoe UI', system-ui, sans-serif; overflow-x: hidden; cursor: auto; }
        .ai-bg { position: fixed; inset: 0; background: radial-gradient(ellipse 120% 80% at 50% 0%, #1a1625 0%, #0f0d14 50%); z-index: 0; }
        .ai-bg::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 60% 40% at 50% 20%, rgba(167,139,250,0.12) 0%, transparent 60%); pointer-events: none; }
        .ai-container { max-width: 900px; margin: 60px auto 0; background: linear-gradient(165deg, rgba(30,27,45,0.97) 0%, rgba(20,18,32,0.98) 100%); border-radius: 20px; padding: 36px 40px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5), 0 0 0 1px rgba(167,139,250,0.08); position: relative; z-index: 2; }
        .ai-scene-wrap { position: relative; margin-bottom: 24px; min-height: 140px; }
        .ai-chat-scene { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 100%; height: 140px; overflow: hidden; perspective: 400px; pointer-events: auto; }
        .ai-scene-canvas { display: block; width: 100%; height: 100%; pointer-events: auto; cursor: crosshair; }
        .ai-bin { position: absolute; left: 50%; top: 50%; font-family: 'Consolas','Monaco',monospace; font-size: 10px; font-weight: 700; color: rgba(167,139,250,0.35); text-shadow: 0 0 6px rgba(167,139,250,0.3); transition: color 0.3s, text-shadow 0.3s, opacity 0.3s; pointer-events: none; }
        .ai-bin.ai-bin-hi { color: #e9d5ff; text-shadow: 0 0 20px rgba(233,213,255,0.9), 0 0 40px rgba(167,139,250,0.5); opacity: 1; }
        .ai-bin-path { position: absolute; left: 50%; top: 50%; width: 0; height: 0; outline: none; }
        .ai-bin-path .ai-bin { animation-timing-function: linear; animation-iteration-count: infinite; animation-fill-mode: backwards; }
        .ai-core { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: radial-gradient(circle, rgba(233,213,255,0.95) 0%, rgba(167,139,250,0.5) 50%, transparent 70%); box-shadow: 0 0 20px rgba(167,139,250,0.4); animation: aiCorePulse 2.2s ease-in-out infinite; transform-origin: center; isolation: isolate; pointer-events: none; }
        .ai-bin-float { animation: aiFloat 6s ease-in-out infinite; pointer-events: none; }
        @keyframes aiFloat { 0%, 100% { transform: translate(-50%, -50%) translate(0, 0) scale(1); opacity: 0.5; } 25% { transform: translate(-50%, -50%) translate(28px, -22px) scale(1.05); opacity: 0.7; } 50% { transform: translate(-50%, -50%) translate(-24px, 18px) scale(0.98); opacity: 0.6; } 75% { transform: translate(-50%, -50%) translate(18px, 25px) scale(1.03); opacity: 0.65; } }
        .ai-bin-float.ai-bin-eaten { animation: aiEaten 0.25s ease-out forwards; pointer-events: none; }
        @keyframes aiEaten { 0% { transform: translate(-50%, -50%) scale(1.5); opacity: 1; filter: brightness(2); } 100% { transform: translate(-50%, -50%) scale(0.1); opacity: 0; filter: brightness(3); } }
        .ai-bin-explode { animation: aiExplode 0.4s ease-out forwards; pointer-events: none; }
        @keyframes aiExplode { 0% { transform: translate(-50%, -50%) translate(var(--ai-ex, 0px), var(--ai-ey, 0px)) scale(1); opacity: 1; filter: brightness(2); } 50% { transform: translate(-50%, -50%) translate(var(--ai-ex, 0px), var(--ai-ey, 0px)) scale(2.5); opacity: 1; filter: brightness(4); } 100% { transform: translate(-50%, -50%) translate(var(--ai-ex, 0px), var(--ai-ey, 0px)) scale(4); opacity: 0; filter: brightness(5); } }
        @keyframes aiCorePulse { 0%, 100% { transform: scale(0.5); opacity: 0.6; } 50% { transform: scale(2); opacity: 1; } }
        .ai-wall-seg { position: absolute; pointer-events: none; animation: aiWallSegFlash 0.5s ease-out forwards; }
        .ai-wall-seg[data-wall="left"], .ai-wall-seg[data-wall="right"] { width: 2px; background: linear-gradient(180deg, transparent 0%, rgba(233,213,255,0.4) 20%, rgba(167,139,250,0.6) 50%, rgba(233,213,255,0.4) 80%, transparent 100%); box-shadow: 0 0 8px rgba(167,139,250,0.4); }
        .ai-wall-seg[data-wall="top"], .ai-wall-seg[data-wall="bottom"] { height: 2px; background: linear-gradient(90deg, transparent 0%, rgba(233,213,255,0.4) 20%, rgba(167,139,250,0.6) 50%, rgba(233,213,255,0.4) 80%, transparent 100%); box-shadow: 0 0 8px rgba(167,139,250,0.4); }
        @keyframes aiWallSegFlash { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
        .ai-cursor-glow { position: absolute; width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle, rgba(233,213,255,0.22) 0%, rgba(167,139,250,0.1) 45%, transparent 70%); box-shadow: 0 0 18px rgba(167,139,250,0.18); pointer-events: none; transform: translate(-50%, -50%); transition: opacity 0.28s; opacity: 0; z-index: 5; }
        @keyframes aiCursorRipple { 0% { transform: translate(-50%,-50%) scale(0.4); opacity: 0.7; } 100% { transform: translate(-50%,-50%) scale(2.2); opacity: 0; } }
        .ai-cursor-ripple { position: absolute; width: 54px; height: 54px; border-radius: 50%; border: 1.5px solid rgba(167,139,250,0.5); pointer-events: none; transform: translate(-50%,-50%) scale(0.4); animation: aiCursorRipple 0.5s ease-out forwards; z-index: 4; }
        .ai-title { font-size: 2rem; margin-bottom: 18px; color: #c4b5fd; }
        /* 聊天工具栏 */
        .ai-chat-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; flex-wrap: wrap; }
        .ai-toolbar-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
        a.ai-home-link { text-decoration: none; display: inline-flex; align-items: center; }
        a.ai-home-link:hover { color: #e9d5ff; border-color: rgba(167, 139, 250, 0.45); }
        .ai-toolbar-right { display: flex; gap: 8px; }
        .ai-file-input-hidden { display: none; }
        .ai-model-select {
            background: rgba(167,139,250,0.1);
            color: #e9d5ff;
            border: 1px solid rgba(167,139,250,0.25);
            border-radius: 8px;
            padding: 4px 10px;
            font-size: 0.82rem;
            min-width: 150px;
        }
        .ai-model-select:focus { outline: none; border-color: rgba(167,139,250,0.5); }
        .ai-submodel-select { min-width: 180px; }
        .ai-attach-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
        .ai-attach-preview {
            display: none;
            align-items: center;
            gap: 8px;
            background: rgba(56,189,248,0.08);
            border: 1px solid rgba(56,189,248,0.25);
            color: #bae6fd;
            border-radius: 10px;
            padding: 8px 10px;
            font-size: 0.82rem;
        }
        .ai-attach-preview img { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; border: 1px solid rgba(167,139,250,0.25); }
        .ai-toolbar-btn { background: rgba(167,139,250,0.1); color: #c4b5fd; border: 1px solid rgba(167,139,250,0.2); border-radius: 8px; padding: 4px 12px; font-size: 0.82rem; cursor: pointer; transition: all 0.2s; }
        .ai-toolbar-btn:hover { background: rgba(167,139,250,0.2); border-color: rgba(167,139,250,0.4); }
        /* 聊天框 */
        .ai-chat-box { height: 420px; overflow-y: auto; background: rgba(15,13,20,0.6); border-radius: 12px; padding: 16px; margin-bottom: 18px; border: 1px solid rgba(167,139,250,0.12); scroll-behavior: smooth; }
        .ai-chat-box::-webkit-scrollbar { width: 4px; }
        .ai-chat-box::-webkit-scrollbar-track { background: transparent; }
        .ai-chat-box::-webkit-scrollbar-thumb { background: rgba(167,139,250,0.3); border-radius: 2px; }
        /* 消息气泡 */
        .ai-msg { margin-bottom: 18px; display: flex; flex-direction: column; }
        .ai-msg.user { align-items: flex-end; }
        .ai-msg.assistant { align-items: flex-start; }
        .msg-label { font-size: 0.78rem; color: rgba(196,181,253,0.6); margin-bottom: 4px; padding: 0 4px; }
        .msg-bubble { max-width: 88%; padding: 12px 16px; border-radius: 14px; line-height: 1.7; font-size: 0.95rem; }
        .ai-msg.user .msg-bubble { background: linear-gradient(135deg, rgba(124,58,237,0.35) 0%, rgba(109,40,217,0.25) 100%); color: #e9d5ff; border: 1px solid rgba(167,139,250,0.2); border-bottom-right-radius: 4px; }
        .ai-msg.assistant .msg-bubble { background: rgba(30,27,45,0.8); color: #e8e4ef; border: 1px solid rgba(167,139,250,0.1); border-bottom-left-radius: 4px; }
        /* 消息操作按钮 */
        .msg-actions { display: flex; gap: 6px; margin-top: 5px; opacity: 0; transition: opacity 0.2s; }
        .ai-msg:hover .msg-actions { opacity: 1; }
        .msg-action-btn { background: rgba(167,139,250,0.08); color: rgba(196,181,253,0.7); border: 1px solid rgba(167,139,250,0.15); border-radius: 6px; padding: 2px 8px; font-size: 0.75rem; cursor: pointer; transition: all 0.15s; }
        .msg-action-btn:hover { background: rgba(167,139,250,0.2); color: #c4b5fd; }
        /* Markdown 内容样式 */
        .markdown-body { word-break: break-word; }
        .markdown-body p { margin: 0 0 10px; }
        .markdown-body p:last-child { margin-bottom: 0; }
        .markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4 { color: #c4b5fd; margin: 14px 0 8px; font-weight: 600; line-height: 1.4; }
        .markdown-body h1 { font-size: 1.3em; border-bottom: 1px solid rgba(167,139,250,0.2); padding-bottom: 6px; }
        .markdown-body h2 { font-size: 1.15em; }
        .markdown-body h3 { font-size: 1.05em; }
        .markdown-body ul,.markdown-body ol { padding-left: 20px; margin: 6px 0 10px; }
        .markdown-body li { margin-bottom: 4px; }
        .markdown-body blockquote { border-left: 3px solid rgba(167,139,250,0.5); padding: 4px 12px; margin: 10px 0; color: rgba(232,228,239,0.7); background: rgba(167,139,250,0.05); border-radius: 0 6px 6px 0; }
        .markdown-body code:not(pre code) { background: rgba(167,139,250,0.15); color: #e9d5ff; padding: 1px 5px; border-radius: 4px; font-family: 'Consolas','Monaco',monospace; font-size: 0.88em; }
        .markdown-body pre { position: relative; margin: 10px 0; border-radius: 8px; overflow: hidden; border: 1px solid rgba(167,139,250,0.15); }
        .markdown-body pre code { font-size: 0.87em; line-height: 1.6; }
        .markdown-body table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 0.9em; }
        .markdown-body th,.markdown-body td { border: 1px solid rgba(167,139,250,0.2); padding: 7px 12px; text-align: left; }
        .markdown-body th { background: rgba(167,139,250,0.12); color: #c4b5fd; font-weight: 600; }
        .markdown-body tr:nth-child(even) td { background: rgba(167,139,250,0.04); }
        .markdown-body strong { color: #e9d5ff; font-weight: 600; }
        .markdown-body em { color: rgba(232,228,239,0.85); }
        .markdown-body a { color: #a78bfa; text-decoration: underline; }
        .markdown-body hr { border: none; border-top: 1px solid rgba(167,139,250,0.2); margin: 14px 0; }
        /* 代码块复制按钮 */
        .code-copy-btn { position: absolute; top: 6px; right: 8px; background: rgba(167,139,250,0.15); color: rgba(196,181,253,0.8); border: 1px solid rgba(167,139,250,0.25); border-radius: 5px; padding: 2px 8px; font-size: 0.75rem; cursor: pointer; transition: all 0.15s; z-index: 1; }
        .code-copy-btn:hover { background: rgba(167,139,250,0.3); color: #e9d5ff; }
        /* 输入区 */
        .ai-input-row { display: flex; gap: 10px; align-items: stretch; position: relative; }
        .ai-input-row input { flex: 1; padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(167,139,250,0.25); background: rgba(15,13,20,0.6); font-size: 1.1rem; color: #e8e4ef; }
        .ai-input-row input::placeholder { color: rgba(232,228,239,0.5); }
        .ai-input-row input:focus { outline: none; border-color: rgba(167,139,250,0.5); box-shadow: 0 0 0 3px rgba(167,139,250,0.1); }
        .ai-input-row button { background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%); color: #fff; border: none; border-radius: 12px; padding: 0 24px; font-size: 1.1rem; cursor: pointer; font-weight: 500; transition: filter 0.2s; white-space: nowrap; }
        .ai-plus-btn {
            width: 46px;
            padding: 0 !important;
            font-size: 1.4rem !important;
            background: rgba(167,139,250,0.08) !important;
            border: 1px solid rgba(167,139,250,0.25) !important;
            color: #ddd6fe !important;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }
        .ai-plus-btn:hover { background: rgba(167,139,250,0.16) !important; }
        .ai-media-menu {
            position: absolute;
            left: 0;
            bottom: 56px;
            width: 186px;
            background: rgba(24,22,34,0.96);
            border: 1px solid rgba(167,139,250,0.28);
            border-radius: 10px;
            padding: 4px;
            box-shadow: 0 8px 16px rgba(0,0,0,0.32);
            z-index: 20;
        }
        .ai-media-menu.hidden { display: none; }
        .ai-media-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 2px 4px;
            align-items: center;
        }
        .ai-media-item {
            width: auto;
            min-width: 48px;
            border: 1px solid transparent;
            background: transparent;
            color: #e5e7eb;
            text-align: center;
            border-radius: 6px;
            padding: 4px 7px;
            font-size: 0.79rem;
            cursor: pointer;
            justify-self: center;
        }
        .ai-media-item:hover {
            background: rgba(167,139,250,0.1);
            border-color: rgba(167,139,250,0.2);
        }
        .ai-media-group-title {
            font-size: 0.66rem;
            color: #9ca3af;
            padding: 2px 0 2px;
            letter-spacing: 0.02em;
            text-align: center;
            font-weight: 600;
        }
        .ai-media-empty {
            min-height: 24px;
        }
        .capture-modal {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.6);
            z-index: 1200;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 16px;
        }
        .capture-modal.show { display: flex; }
        .capture-panel {
            width: min(520px, 92vw);
            background: #171422;
            border: 1px solid rgba(167,139,250,0.28);
            border-radius: 14px;
            padding: 12px;
        }
        .capture-title { font-size: 1rem; color: #c4b5fd; margin-bottom: 10px; }
        .capture-view {
            width: 100%;
            min-height: 170px;
            max-height: 40vh;
            border-radius: 10px;
            background: #0f0d14;
            border: 1px solid rgba(167,139,250,0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            color: #94a3b8;
            font-size: 0.92rem;
        }
        .capture-view video { width: 100%; height: 100%; object-fit: contain; background: #0b0a10; }
        .capture-actions { margin-top: 12px; display: flex; gap: 10px; justify-content: flex-end; }
        .capture-btn {
            border: 1px solid rgba(167,139,250,0.25);
            background: rgba(167,139,250,0.12);
            color: #ddd6fe;
            border-radius: 10px;
            padding: 8px 14px;
            cursor: pointer;
        }
        .capture-btn.primary {
            background: linear-gradient(135deg,#a78bfa,#7c3aed);
            border-color: transparent;
            color: #fff;
        }
        .ai-input-row button:hover { filter: brightness(1.1); }
        .ai-input-row button:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
        .ai-status { margin: 10px 0; color: #ffb37b; font-size: 0.9rem; }
        /* 游客限制提示 */
        .ai-guest-limit { display: none; background: linear-gradient(135deg, rgba(124,58,237,0.2) 0%, rgba(167,139,250,0.1) 100%); border: 1px solid rgba(167,139,250,0.3); border-radius: 12px; padding: 18px 20px; margin-top: 14px; text-align: center; }
        .ai-guest-limit p { margin: 0 0 12px; color: #c4b5fd; font-size: 0.95rem; }
        .ai-guest-limit-btn { background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%); color: #fff; border: none; border-radius: 10px; padding: 8px 28px; font-size: 0.95rem; cursor: pointer; font-weight: 500; }
        .ai-guest-limit-btn:hover { filter: brightness(1.1); }
        /* 思考过程 */
        .msg-thinking { background: rgba(167,139,250,0.06); border: 1px solid rgba(167,139,250,0.12); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; font-size: 0.82rem; color: rgba(196,181,253,0.6); }
        .msg-thinking-toggle { cursor: pointer; color: rgba(167,139,250,0.6); font-size: 0.8rem; margin-bottom: 8px; user-select: none; }
        .msg-thinking-toggle:hover { color: #a78bfa; }
        @media (max-width: 768px) {
            .ai-container { max-width: 95%; padding: 24px 20px; }
            .ai-scene-wrap { min-height: 120px; }
            .ai-chat-scene { height: 120px; }
            .msg-bubble { max-width: 96%; }
        }

        /* OPC Gate Starter Prompts */
        .ai-starter-panel {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px;
            margin-bottom: 10px;
            padding: 8px 10px;
            border-radius: 10px;
            background: rgba(99, 102, 241, 0.12);
            border: 1px solid rgba(167, 139, 250, 0.22);
        }
        .ai-starter-label {
            font-size: 0.78rem;
            color: #a78bfa;
            font-weight: 600;
            flex-shrink: 0;
        }
        .ai-starter-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
        }
        .ai-starter-chip {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 5px 10px;
            border-radius: 999px;
            border: 1px solid rgba(167, 139, 250, 0.35);
            background: rgba(30, 27, 45, 0.8);
            color: #e9d5ff;
            font-size: 0.76rem;
            cursor: pointer;
        }
        .ai-starter-chip:hover {
            border-color: rgba(167, 139, 250, 0.65);
            background: rgba(99, 102, 241, 0.25);
        }
        .ai-starter-icon { font-size: 0.9rem; }
