        /* ============================================
         * 杩炵画瀵硅瘽 - 鑱婂ぉ鐣岄潰鏍峰紡
         * ============================================ */

        /* 閰嶇疆鏍?*/
        .chat-config-bar {
            border-bottom: 1px solid var(--border-color);
            background: var(--bg-tertiary);
            flex-shrink: 0;
            padding: 5px 12px;
            position: relative;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: flex-start;
            box-sizing: border-box;
            overflow: hidden;
        }

        /* 涓ゆ帓鍐呰仈甯冨眬 */
        .config-row-inline {
            display: flex;
            align-items: center;
            justify-content: flex-start;
            gap: 12px;
            flex-wrap: nowrap;
        }

        .config-row-inline+.config-row-inline {
            margin-top: 6px;
            padding-top: 6px;
            border-top: 1px solid var(--border-color);
        }

        .config-item {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-shrink: 0;
        }

        .config-item>label {
            font-size: 14px;
            color: var(--text-secondary);
            white-space: nowrap;
        }

        .config-select-sm {
            padding: 4px 4px;
            padding-right: 16px;
            background: var(--bg-secondary);
            border: 1px solid var(--border-color);
            border-radius: 6px;
            color: var(--text-primary);
            font-size: 13px;
            cursor: pointer;
            appearance: none;
            -webkit-appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239ca3af' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-size: 10px 10px;
            background-position: right 4px center;
        }

        .config-select-sm:focus {
            outline: none;
            border-color: var(--accent);
        }

        .config-select-sm option {
            background: var(--bg-secondary);
            color: var(--text-primary);
        }

        .subject-select-sm {
            width: 80px;
        }

        .dimension-select-sm {
            width: 65px;
        }

        /* 绗簩鎺掞細缇庡寲闈㈡澘鍒囨崲鎸夐挳 */
        .beautify-toggle-btn {
            padding: 3px 10px;
            border-radius: 6px;
            background: transparent;
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            font-size: 13px;
            cursor: pointer;
            white-space: nowrap;
            transition: all 0.2s;
            flex-shrink: 0;
        }

        .beautify-toggle-btn:hover,
        .beautify-toggle-btn.active {
            border-color: var(--accent);
            color: var(--accent);
            background: rgba(99, 102, 241, 0.08);
        }

        .beautify-toggle-btn i {
            margin-right: 3px;
        }

        /* 鍙姌鍙犵編鍖栭潰鏉匡紙娴姩瑕嗙洊锛屼笉褰卞搷鑱婂ぉ鍖洪珮搴︼級 */
        .beautify-panel {
            display: none;
            position: absolute;
            left: 0;
            right: 0;
            top: 100%;
            z-index: 100;
            background: var(--bg-tertiary);
            border-bottom: 1px solid var(--border-color);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
            padding: 6px 12px 8px;
        }

        .beautify-panel.show {
            display: block;
        }

        .beautify-row {
            display: grid;
            grid-template-columns: 60px repeat(3, 1fr);
            align-items: stretch;
            gap: 0;
            padding: 0;
            border-bottom: 1px solid var(--border-color);
        }

        .beautify-row:last-child {
            border-bottom: none;
        }

        .adjust-group-label {
            font-size: 12px;
            color: var(--accent);
            font-weight: 600;
            white-space: nowrap;
            text-align: left;
            padding: 5px 6px;
            display: flex;
            align-items: center;
        }

        .adjust-option {
            display: flex;
            align-items: center;
            gap: 3px;
            font-size: 12px;
            color: var(--text-secondary);
            cursor: pointer;
            white-space: nowrap;
            padding: 5px 8px;
        }

        .adjust-option input[type="checkbox"] {
            width: 13px;
            height: 13px;
            accent-color: var(--accent);
            cursor: pointer;
        }

        .adjust-option span {
            user-select: none;
        }

        .adjust-divider {
            color: var(--border-color);
            font-size: 12px;
            user-select: none;
        }

        /* 鑱婂ぉ娑堟伅鍖?*/
        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 16px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            scroll-behavior: smooth;
        }

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

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

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

        /* 娆㈣繋鐣岄潰 */
        .chat-welcome {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            padding: 40px 20px;
            flex: 1;
            min-height: 300px;
        }

        .welcome-icon {
            font-size: 48px;
            color: var(--accent);
            margin-bottom: 16px;
            opacity: 0.8;
        }

        .chat-welcome h3 {
            font-size: 20px;
            font-weight: 600;
            color: var(--text-primary);
            margin: 0 0 8px;
        }

        .chat-welcome p {
            font-size: 14px;
            color: var(--text-secondary);
            margin: 0 0 24px;
        }

        /* 娆㈣繋椤典娇鐢ㄦ寚鍗?*/
        .welcome-guide {
            width: 100%;
            max-width: 460px;
            text-align: left;
            display: flex;
            flex-direction: column;
            gap: 14px;
        }

        .guide-section {
            padding: 0;
        }

        .guide-title {
            font-size: 14px;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: 6px;
            padding-bottom: 4px;
            border-bottom: 1px solid var(--border-color);
        }

        .guide-steps {
            margin: 0;
            padding-left: 22px;
            line-height: 1.9;
            font-size: 13px;
            color: var(--text-secondary);
        }

        .guide-steps li {
            margin-bottom: 2px;
        }

        .guide-steps li strong {
            color: var(--text-primary);
        }

        .guide-notes {
            margin: 0;
            padding-left: 18px;
            line-height: 1.8;
            font-size: 13px;
            color: var(--text-secondary);
            list-style: disc;
        }

        .guide-notes li {
            margin-bottom: 2px;
        }

        .guide-notes li strong {
            color: var(--text-primary);
        }

        .guide-example-tip {
            margin-top: 6px;
            padding: 6px 10px;
            background: rgba(99, 102, 241, 0.06);
            border-radius: 6px;
            font-size: 12px;
            color: var(--text-secondary);
            line-height: 1.6;
        }

        .guide-keywords {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .guide-keywords .keyword-group {
            display: flex;
            align-items: center;
            gap: 6px;
            flex-wrap: wrap;
        }

        .guide-keywords .keyword-label {
            font-size: 12px;
            color: var(--accent);
            font-weight: 600;
            white-space: nowrap;
            min-width: 56px;
        }

        .guide-keywords .keyword-tag {
            font-size: 11px;
            padding: 2px 8px;
            background: var(--bg-tertiary);
            border: 1px solid var(--border-color);
            border-radius: 4px;
            color: var(--text-secondary);
            white-space: nowrap;
        }

        .welcome-tips {
            width: 100%;
            margin-top: 14px;
            display: flex;
            justify-content: center;
        }

        .welcome-tips .help-link {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            min-height: 34px;
            padding: 5px 14px;
            color: var(--accent);
            background: rgba(129, 140, 248, 0.1);
            border: 1px solid rgba(129, 140, 248, 0.24);
            border-radius: 18px;
            font-size: 16px;
            font-weight: 700;
            line-height: 1.4;
            cursor: pointer;
            user-select: none;
            transition: opacity 0.2s, transform 0.2s, background 0.2s;
        }

        .welcome-tips .help-link:hover {
            opacity: 0.92;
            background: rgba(129, 140, 248, 0.16);
            text-decoration: underline;
            transform: translateY(-1px);
        }

        .welcome-upload-hint {
            margin-top: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 7px;
            color: var(--text-secondary);
            font-size: 14px;
            line-height: 1.6;
        }

        .welcome-upload-hint i {
            color: var(--accent);
            font-size: 15px;
        }

        .welcome-upload-link {
            padding: 0;
            border: 0;
            color: var(--accent);
            background: transparent;
            font: inherit;
            font-weight: 700;
            cursor: pointer;
            text-decoration: underline;
            text-underline-offset: 3px;
        }

        .welcome-upload-link:hover {
            color: #a5b4fc;
        }

        .welcome-upload-link:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 3px;
            border-radius: 2px;
        }

        .welcome-upload-hint kbd {
            display: inline-block;
            padding: 0 6px;
            border: 1px solid var(--border-color);
            border-bottom-color: rgba(148, 163, 184, 0.55);
            border-radius: 4px;
            color: var(--text-primary);
            background: var(--bg-tertiary);
            box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
            font-family: inherit;
            font-size: 12px;
            font-weight: 700;
            line-height: 1.6;
        }

        /* 鐢ㄦ埛娑堟伅姘旀场 */
        .chat-bubble {
            animation: bubbleFadeIn 0.3s ease;
        }

        @keyframes bubbleFadeIn {
            from {
                opacity: 0;
                transform: translateY(8px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .chat-bubble.user {
            align-self: flex-end;
            max-width: 85%;
            padding: 10px 14px;
            border-radius: 16px 16px 4px 16px;
            background: rgba(99, 102, 241, 0.15);
            border: 1px solid rgba(99, 102, 241, 0.25);
            color: var(--text-primary);
            font-size: 14px;
            line-height: 1.6;
            word-break: break-word;
        }

        .chat-bubble.user .user-images {
            display: flex;
            gap: 6px;
            margin-top: 8px;
            flex-wrap: wrap;
        }

        .chat-bubble.user .user-images img {
            width: 60px;
            height: 60px;
            object-fit: cover;
            border-radius: 6px;
            border: 1px solid var(--border-color);
        }

        /* AI娑堟伅锛氬灞傚彧璐熻矗鎺掑垪锛屽唴瀹规湰韬綔涓哄敮涓€姘旀场鏄剧ず */
        .chat-bubble.ai {
            align-self: flex-start;
            max-width: 100%;
            width: 100%;
            padding: 0;
            border-radius: 0;
            background: transparent;
            border: none;
            color: var(--text-primary);
            font-size: 14px;
            line-height: 1.7;
            word-break: break-word;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 10px;
        }

        .chat-bubble.ai .ai-label {
            display: none;
        }

        .chat-bubble.ai .ai-text {
            white-space: pre-wrap;
            max-width: min(86%, 380px);
            padding: 10px 14px;
            border-radius: 16px 16px 16px 4px;
            background: rgba(99, 102, 241, 0.15);
            border: 1px solid rgba(99, 102, 241, 0.25);
            color: var(--text-primary);
        }

        .chat-bubble.ai .ai-text:empty {
            display: none;
        }

        /* AI 鐢熸垚杩涘害鏉?*/
        .ai-progress-wrap {
            width: min(86%, 280px);
            max-width: 100%;
            max-height: 140px;
            margin: 2px 0 10px;
            padding: 10px 14px 12px;
            overflow: hidden;
            box-sizing: border-box;
            border-radius: 16px 16px 16px 4px;
            background: rgba(99, 102, 241, 0.15);
            border: 1px solid rgba(99, 102, 241, 0.25);
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
            color: var(--text-primary);
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .ai-progress-bar {
            order: 2;
            height: 6px;
            background: rgba(255, 255, 255, 0.12);
            border-radius: 999px;
            overflow: hidden;
            position: relative;
        }

        .ai-progress-fill {
            height: 100%;
            width: 0%;
            background: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7, #c084fc);
            background-size: 200% 100%;
            border-radius: inherit;
            transition: width 0.3s ease-out;
            animation: progressShimmer 2s linear infinite;
            position: relative;
        }

        .ai-progress-glow {
            position: absolute;
            top: -3px;
            right: 0;
            width: 30px;
            height: 12px;
            background: radial-gradient(ellipse, rgba(139, 92, 246, 0.6), transparent);
            filter: blur(3px);
            animation: progressGlowPulse 1.5s ease-in-out infinite;
        }

        .ai-progress-status {
            order: 1;
            font-size: 12px;
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            gap: 4px;
            min-width: 0;
            line-height: 1.4;
            transition: opacity 0.3s;
        }

        .ai-progress-status::before {
            content: '';
            display: inline-block;
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: #8b5cf6;
            animation: progressDotPulse 1s ease-in-out infinite;
        }

        @keyframes progressShimmer {
            0% {
                background-position: -200% 0;
            }

            100% {
                background-position: 200% 0;
            }
        }

        @keyframes progressGlowPulse {

            0%,
            100% {
                opacity: 0.3;
            }

            50% {
                opacity: 1;
            }
        }

        @keyframes progressDotPulse {

            0%,
            100% {
                opacity: 0.4;
                transform: scale(0.8);
            }

            50% {
                opacity: 1;
                transform: scale(1.2);
            }
        }

        /* AI 鍒嗘瀽鎬濊矾灞曠ず鍧?*/
        .ai-thought-block {
            background: rgba(139, 92, 246, 0.08);
            border-left: 3px solid rgba(139, 92, 246, 0.5);
            border-radius: 0 8px 8px 0;
            padding: 10px 14px;
            margin-bottom: 10px;
        }

        .ai-thought-title {
            font-size: 13px;
            font-weight: 600;
            color: #a78bfa;
            margin-bottom: 6px;
        }

        .ai-thought-content {
            font-size: 13px;
            line-height: 1.6;
            color: var(--text-secondary, #c0c0c0);
            white-space: pre-wrap;
        }

        .chat-bubble.ai .ai-text .cmd-separator {
            display: block;
            text-align: center;
            color: var(--text-muted);
            font-size: 12px;
            margin: 12px 0;
            border-top: 1px dashed var(--border-color);
            padding-top: 8px;
        }

        /* AI娑堟伅涓殑娴佸紡鍏夋爣 */
        .ai-cursor {
            display: inline-block;
            width: 8px;
            height: 16px;
            background: var(--accent);
            margin-left: 2px;
            vertical-align: text-bottom;
            animation: cursorBlink 1s infinite;
        }

        @keyframes cursorBlink {

            0%,
            50% {
                opacity: 1;
            }

            51%,
            100% {
                opacity: 0;
            }
        }

        /* 鍘熷鎸囦护鏂囨湰鎶樺彔鍧?*/
        .ai-raw-cmd-wrap {
            margin-top: 10px;
        }

        .ai-raw-cmd-toggle {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 4px 10px;
            border-radius: 5px;
            border: 1px solid var(--border-color);
            background: transparent;
            color: var(--text-muted);
            font-size: 11px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .ai-raw-cmd-toggle:hover {
            border-color: var(--accent);
            color: var(--accent);
        }

        .ai-raw-cmd-content {
            margin-top: 8px;
            padding: 10px 12px;
            background: rgba(0, 0, 0, 0.2);
            border-radius: 6px;
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            font-size: 12px;
            line-height: 1.6;
            color: var(--text-secondary);
            white-space: pre-wrap;
            word-break: break-all;
            max-height: 400px;
            overflow-y: auto;
            transition: max-height 0.3s ease, opacity 0.3s ease;
        }

        .ai-raw-cmd-wrap.collapsed .ai-raw-cmd-content {
            display: none;
        }

        /* 鍛戒护鍧楋紙宓屽叆鍦ˋI娑堟伅鍐咃級 */
        .chat-cmd-block {
            width: min(100%, 420px);
            margin-top: 0;
            border-radius: 8px;
            border: 1px solid rgba(99, 102, 241, 0.25);
            background: rgba(99, 102, 241, 0.04);
            overflow: hidden;
        }

        .chat-cmd-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 6px 12px;
            background: rgba(99, 102, 241, 0.08);
            border-bottom: 1px solid rgba(99, 102, 241, 0.15);
            gap: 8px;
        }

        .chat-cmd-header .cmd-count {
            font-size: 12px;
            color: var(--accent);
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .chat-cmd-header .cmd-actions-row {
            display: flex;
            gap: 6px;
        }

        .chat-cmd-exec-btn {
            padding: 3px 10px;
            border-radius: 5px;
            border: none;
            font-size: 11px;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 4px;
            font-weight: 500;
        }

        .chat-cmd-exec-btn.primary {
            background: var(--accent);
            color: white;
        }

        .chat-cmd-exec-btn.primary:hover {
            background: var(--accent-hover);
        }

        .chat-cmd-exec-btn.secondary {
            background: transparent;
            color: var(--text-secondary);
            border: 1px solid var(--border-color);
        }

        .chat-cmd-exec-btn.secondary:hover {
            border-color: var(--accent);
            color: var(--accent);
        }

        .chat-cmd-list {
            max-height: 2000px;
            overflow-y: auto;
            transition: max-height 0.3s ease;
        }

        .chat-cmd-list.collapsed {
            max-height: 0;
            overflow: hidden;
        }

        .chat-cmd-list.expanded {
            max-height: 2000px;
        }

        .chat-cmd-list::-webkit-scrollbar {
            width: 4px;
        }

        .chat-cmd-list::-webkit-scrollbar-thumb {
            background: var(--border-color);
            border-radius: 2px;
        }

        .chat-cmd-item {
            padding: 3px 12px;
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            font-size: 12px;
            color: var(--text-secondary);
            cursor: pointer;
            transition: background 0.15s;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .chat-cmd-item:hover {
            background: var(--bg-hover);
        }

        .chat-cmd-item .cmd-num {
            color: var(--text-muted);
            font-size: 10px;
            min-width: 18px;
            text-align: right;
            flex-shrink: 0;
        }

        .chat-cmd-item .cmd-text {
            flex: 1;
            white-space: pre-wrap;
            word-break: break-all;
        }

        .chat-cmd-item.success {
            color: var(--success);
        }

        .chat-cmd-item.error {
            color: #ef4444;
        }

        .chat-cmd-item.running {
            color: var(--accent);
        }

        .chat-cmd-item .cmd-status-icon {
            font-size: 10px;
            flex-shrink: 0;
        }
        .chat-courseware-save-action[hidden] {
            display: none;
        }

        .chat-courseware-save-action {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 9px 12px;
            border-top: 1px solid rgba(99, 102, 241, 0.18);
            background: rgba(15, 23, 42, 0.28);
        }

        .chat-courseware-save-status {
            min-width: 0;
            flex: 1;
            color: var(--text-secondary);
            font-size: 11px;
            line-height: 1.45;
        }

        .chat-courseware-save-btn {
            min-height: 32px;
            padding: 6px 14px;
            border: 0;
            border-radius: 6px;
            background: #16a34a;
            color: #fff;
            font-size: 12px;
            font-weight: 700;
            white-space: nowrap;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            transition: background 0.2s, transform 0.2s;
        }

        .chat-courseware-save-btn:hover {
            background: #15803d;
            transform: translateY(-1px);
        }

        .chat-courseware-save-btn:focus-visible {
            outline: 2px solid #86efac;
            outline-offset: 2px;
        }

        @media (max-width: 520px) {
            .chat-courseware-save-action {
                align-items: stretch;
                flex-direction: column;
            }

            .chat-courseware-save-btn {
                width: 100%;
            }
        }
