        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            background: #e2e8f0;
            font-family: system-ui, 'Segoe UI', 'Noto Sans CJK SC', '微软雅黑', Roboto, sans-serif;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 100vh;
            padding: 30px 20px;
            padding-right: 320px;
            padding-left: 320px;
        }
        .workspace { max-width: 1300px; width: 100%; }
        .api-bar {
            background: white;
            border-radius: 28px;
            padding: 16px 24px;
            margin-bottom: 24px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.05);
            display: flex;
            flex-wrap: wrap;
            gap: 16px;
            align-items: flex-end;
        }
        .api-field { flex: 1; min-width: 180px; }
        .api-field label { display: block; font-size: 12px; font-weight: 600; color: #2d5e2c; margin-bottom: 4px; }
        .api-field input { width: 100%; padding: 8px 12px; border: 1px solid #ccc; border-radius: 24px; font-size: 14px; font-family: monospace; }
        .btn-primary {
            background: #2c5f2d;
            color: white;
            border: none;
            padding: 8px 24px;
            border-radius: 32px;
            cursor: pointer;
            font-weight: bold;
            transition: 0.2s;
        }
        .btn-primary:hover { background: #1f4520; }
        .btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }
        /* ===== 导入页面粘贴区 ===== */
        .paste-area {
            max-width: 100%;
            margin: 0 auto;
            padding: 16px 32px 24px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            height: calc(100vh - 60px);
            box-sizing: border-box;
            overflow-y: auto;
        }
        .paste-header { text-align: center; }
        .paste-header-title {
            font-size: 18px;
            font-weight: 700;
            color: #1f2937;
            margin-bottom: 12px;
        }
        .paste-header-lines {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
        }
        .paste-header-sub {
            font-size: 13px;
            color: #6b7280;
        }
        .paste-hint-line {
            font-size: 13px;
            color: #6b7280;
            line-height: 1.5;
        }
        .hint-fast { color: #16a34a; font-weight: 600; }
        .hint-slow { color: #6b7280; font-weight: 500; }
        .paste-api-hint {
            font-size: 12px;
            color: #9ca3af;
        }
        .paste-api-hint.warn { color: #d97706; }

        /* 双卡布局 */
        .import-cards {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
        }
        .import-card {
            border-radius: 14px;
            padding: 16px 20px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            background: #f8fafc;
            border: 2px solid #e2e8f0;
        }
        .import-card-badge {
            display: inline-block;
            align-self: flex-start;
            font-size: 12px;
            font-weight: 700;
            padding: 3px 10px;
            border-radius: 20px;
            background: #16a34a;
            color: #fff;
        }
        .import-card-title {
            font-size: 15px;
            font-weight: 700;
            color: #1f2937;
        }
        .import-card-features {
            display: flex;
            flex-direction: column;
            gap: 3px;
        }
        .import-feature {
            font-size: 13px;
            font-weight: 500;
        }
        .feature-good { color: #15803d; }
        .feature-warn { color: #d97706; }
        .import-card-steps {
            display: flex;
            flex-direction: column;
            gap: 2px;
            padding: 8px 12px;
            background: rgba(255,255,255,.6);
            border-radius: 10px;
        }
        .import-step {
            font-size: 12px;
            color: #374151;
            line-height: 1.6;
        }
        .import-card-desc {
            font-size: 12px;
            color: #6b7280;
            line-height: 1.6;
        }
        .import-card-btn {
            margin-top: auto;
            padding: 10px 0;
            border: none;
            border-radius: 10px;
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.15s, opacity 0.15s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
        }
        .import-card-btn-primary {
            background: #16a34a;
            color: #fff;
        }
        .import-card-btn-primary:hover { background: #15803d; }

        /* 文本域 */
        .paste-area textarea {
            width: 100%;
            min-height: 200px;
            flex: 1;
            padding: 14px 20px;
            border: 2px dashed #d1d5db;
            border-radius: 16px;
            font-size: 14px;
            line-height: 1.7;
            color: #374151;
            resize: vertical;
            outline: none;
            box-sizing: border-box;
            transition: border-color 0.2s, background 0.2s;
            font-family: inherit;
            background: #fafbfc;
        }
        .paste-area textarea:focus {
            border-color: #6b9e6b;
            background: #f9fdf9;
        }
        .paste-area textarea::placeholder {
            color: #a3b8a3;
            font-size: 13px;
        }

        /* 导入按钮 */
        .paste-import-btn {
            width: 100%;
            padding: 16px 0;
            background: #2c5f2d;
            color: white;
            border: none;
            border-radius: 14px;
            font-size: 17px;
            font-weight: 700;
            cursor: pointer;
            transition: background 0.15s;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }
        .paste-import-btn:hover { background: #1f4520; }

        /* 窄屏卡片堆叠 */
        @media (max-width: 750px) {
            .import-cards {
                grid-template-columns: 1fr;
            }
            .paste-area {
                padding: 16px;
            }
        }
        .action-buttons { display: flex; gap: 12px; margin-top: 12px; justify-content: flex-end; }
        .export-bar {
            background: white;
            border-radius: 28px;
            padding: 16px 24px;
            margin-bottom: 24px;
            display: flex;
            gap: 20px;
            align-items: center;
            justify-content: flex-end;
            flex-wrap: wrap;
            box-shadow: 0 2px 8px rgba(0,0,0,0.05);
        }
        .export-bar select, .export-bar button { padding: 8px 16px; border-radius: 32px; border: 1px solid #ccc; font-size: 14px; }
        .selection-info {
            background: #f0f4ff;
            padding: 6px 16px;
            border-radius: 32px;
            font-size: 13px;
            display: inline-flex;
            align-items: center;
            gap: 12px;
        }
        .selection-info span { font-weight: 600; }
        .loading { text-align: center; padding: 40px 20px; color: #2c5f2d; font-weight: bold; font-size: 16px; }
        .loading-steps { margin-top: 12px; font-size: 14px; color: #555; font-weight: normal; }
        .loading-step { padding: 4px 0; opacity: 0.5; transition: opacity 0.3s; }
        .loading-step.active { opacity: 1; color: #2c5f2d; font-weight: 600; }
        .loading-step.done { opacity: 0.8; color: #27ae60; }
        .loading-step.done::before { content: '✅ '; }
        .loading-step.active::before { content: '⏳ '; }
        .loading-step.pending::before { content: '⬜ '; }
        .loading-step.error::before { content: '❌ '; }
        .loading-step.error { color: #b91c1c; opacity: 1; }
        .concurrent-progress {
            background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 16px;
            padding: 16px 20px; margin-top: 16px; text-align: left;
            max-width: 600px; margin-left: auto; margin-right: auto;
        }
        .concurrent-progress-title { font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 10px; }
        .concurrent-task-list { display: flex; flex-direction: column; gap: 4px; }
        .concurrent-task-item {
            display: flex; align-items: center; gap: 8px; font-size: 12px;
            padding: 4px 8px; border-radius: 8px; transition: background 0.2s;
        }
        .concurrent-task-item.task-pending { background: #f3f4f6; color: #6b7280; }
        .concurrent-task-item.task-running { background: #eff6ff; color: #1d4ed8; }
        .concurrent-task-item.task-done { background: #f0fdf4; color: #15803d; }
        .concurrent-task-item.task-error { background: #fff1f2; color: #be123c; }
        .task-icon { font-size: 14px; flex-shrink: 0; }
        .task-label { flex: 1; }
        .task-status { font-size: 11px; opacity: 0.8; }
        .pages-container {
            background: #b0b7bc;
            padding: 30px 20px;
            border-radius: 28px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 28px;
            box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05), 0 10px 20px rgba(0,0,0,0.1);
        }
        .a4-page {
            width: 820px;
            min-height: 1122px;
            background: white;
            border-radius: 12px;
            box-shadow: 0 12px 30px rgba(0,0,0,0.2);
            position: relative;
            transition: all 0.1s;
            display: flex;
            flex-direction: column;
            font-size: 16px;
            line-height: 1.5;
            break-after: page;
        }
        .page-content { width: 100%; flex: 1; }
        /* 含田字格时需要足够行高容纳拼音 */
        .paragraph-node {
            line-height: 1.5;
        }
        [data-node-id] {
            position: relative;
            transition: background 0.1s ease, outline 0.1s ease;
            cursor: pointer;
            border-radius: 8px;
            padding: 1px 2px;
            margin: 0;
        }
        [data-node-id]:hover { background: #fef9e3; outline: 1px dashed #c0a86a; }
        [data-node-type="frame"]:hover { background: transparent; outline: none; }
        .paragraph-node { margin: 0; }
        .grid-node { position: relative; transition: background 0.1s, outline 0.1s; }
        .grid-node .grid-items {
            display: grid;
            gap: 0px 8px;
            justify-items: start;
            align-items: center;
        }
        .grid-item {
            padding: 6px 10px;
            font-size: 1rem;
            text-align: left;
            width: 100%;
            height: 100%;
            box-sizing: border-box;
            word-break: break-word;
            cursor: text;
            display: flex;
            align-items: baseline;
            gap: 4px;
            box-sizing: border-box;
            line-height: 1.5;
        }
        .grid-item:hover { background: #f9f5e6; border-radius: 8px; }
        .item-number {
            flex-shrink: 0;
            font-variant-numeric: tabular-nums;
            user-select: none;
            color: inherit;
        }
        .item-content { flex: 1; min-width: 0; }
        .grid-border-box {
            position: absolute; inset: 0px; pointer-events: none;
            box-sizing: border-box; border-radius: 4px;
            border: 0px solid transparent; opacity: 0; transition: opacity 0.15s;
        }
        [data-node-id].node-selected .grid-border-box { opacity: 0; }
        .col-resizer {
            position: absolute; width: 8px; top: 0; height: 100%;
            cursor: col-resize; z-index: 20; display: flex; align-items: center; justify-content: center;
        }
        .col-resizer::after {
            content: ''; width: 2px; height: 60%; background: #3b82f6;
            border-radius: 2px; opacity: 0.6;
        }
        .col-resizer:hover::after { opacity: 1; height: 100%; }
        /* ★ 网格单元格选中高亮 */
        .grid-item.grid-cell-selected {
            outline: 2px solid #3b82f6 !important;
            outline-offset: -2px;
            background: rgba(219, 234, 254, 0.35) !important;
            z-index: 1;
            position: relative;
        }
        .grid-item.grid-row-selected {
            outline: 2px solid #f59e0b !important;
            outline-offset: -2px;
            background: rgba(254, 243, 199, 0.4) !important;
            z-index: 1;
            position: relative;
        }
        .grid-item.grid-col-selected {
            outline: 2px solid #8b5cf6 !important;
            outline-offset: -2px;
            background: rgba(237, 233, 254, 0.4) !important;
            z-index: 1;
            position: relative;
        }
        .grid-item.grid-cell-selected:hover,
        .grid-item.grid-row-selected:hover,
        .grid-item.grid-col-selected:hover {
            cursor: pointer;
        }
        [data-node-id].node-selected {
            background: rgba(219, 234, 254, 0.2);
            outline: 1px solid #bfdbfe !important;
            border-radius: 8px;
            z-index: 10;
        }
        .answer-inline {
            display: inline;
            color: inherit;
            font-size: inherit;
            font-family: inherit;
            vertical-align: baseline;
            line-height: inherit;
            transition: color 0.15s;
            padding: 0;
        }
        .answer-blank {
            display: inline;
            text-decoration: underline;
            text-decoration-thickness: 1.2px;
            text-underline-offset: 4px;
            padding: 0 0.2em;
            line-height: inherit;
            vertical-align: baseline;
        }
        .answer-below-wrapper {
            display: block;
            width: 100%;
            margin-top: 2px;
        }
        .answer-below-line {
            display: block;
            width: 100%;
            min-height: 1.2em;
            padding: 0 0 2px 0;
            box-sizing: border-box;
            word-break: normal;
            white-space: pre-wrap;
            line-height: 1.6;
            margin-bottom: 6px;
            border-bottom: 1px solid #999;
            overflow: hidden;
            print-color-adjust: exact;
            -webkit-print-color-adjust: exact;
        }
        .answer-below-line:last-child { margin-bottom: 0; }
        /* 相邻两行都有分数时，增大行间距防止分数重叠 */
        .answer-below-line.has-fraction {
            margin-bottom: 10px;
        }
        .answer-below-line.has-fraction + .answer-below-line.has-fraction {
            margin-top: 10px;
        }
        .raw-text-node {
            background: #f8f8f8;
            border-left: 3px solid #d1d5db;
            padding: 8px 14px;
            white-space: pre-wrap;
            word-break: break-word;
            font-family: 'Courier New', monospace;
            font-size: 15px;
            line-height: 1.7;
            color: #374151;
            border-radius: 0 6px 6px 0;
        }
        .raw-text-badge {
            display: inline-block;
            font-size: 10px;
            background: #e5e7eb;
            color: #6b7280;
            border-radius: 4px;
            padding: 1px 6px;
            margin-bottom: 4px;
            font-family: system-ui;
        }

        /* ===== 左侧栏 ===== */
        .left-sidebar {
            position: fixed; left: 0; top: 0; width: 300px; height: 100vh;
            background: #fff; box-shadow: 2px 0 16px rgba(0,0,0,0.08);
            z-index: 1002; overflow-y: auto; overflow-x: hidden;
            font-size: 13px; border-right: 1px solid #e5e7eb;
            display: flex; flex-direction: column;
        }
        .left-sidebar-header {
            display: flex; justify-content: space-between; align-items: center;
            padding: 18px 20px 14px; flex-shrink: 0;
        }
        .left-sidebar-header h3 { font-size: 20px; font-weight: 700; color: #2c5f2d; letter-spacing: 1px; }
        .user-info-bar {
            background: #f0fdf4; border: 1px solid #86efac; border-radius: 10px;
            padding: 10px 12px; margin: 0 16px 12px; display: flex;
            align-items: center; justify-content: space-between;
        }
        .user-info-bar .user-name { font-weight: 600; color: #166534; font-size: 14px; }
        .user-info-bar .logout-btn {
            background: none; border: 1px solid #d1d5db; border-radius: 6px;
            padding: 3px 10px; font-size: 12px; cursor: pointer; color: #6b7280;
        }
        .user-info-bar .logout-btn:hover { background: #fff1f2; border-color: #fca5a5; color: #dc2626; }

        /* 按钮行：并排 */
        .sidebar-btn-row {
            display: flex; gap: 8px; padding: 0 16px 12px; flex-shrink: 0;
        }
        .left-action-btn {
            flex: 1; padding: 10px 0; border-radius: 12px; border: 1px solid #e5e7eb;
            font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s;
            display: flex; align-items: center; justify-content: center; gap: 4px;
            white-space: nowrap;
        }
        .left-action-btn.primary { background: #2c5f2d; color: white; border-color: #2c5f2d; }
        .left-action-btn.primary:hover { background: #1f4520; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(44,95,45,0.25); }
        .left-action-btn.secondary { background: #f0f9ff; color: #0369a1; border-color: #bae6fd; font-weight: 700; }
        .left-action-btn.secondary:hover { background: #e0f2fe; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(3,105,161,0.12); }

        /* 可折叠区块通用 */
        .sidebar-section-header {
            display: flex; justify-content: space-between; align-items: center;
            padding: 10px 16px; cursor: pointer; user-select: none;
            font-size: 13px; font-weight: 600; color: #374151;
            border-top: 1px solid #f3f4f6;
            transition: background 0.15s;
        }
        .sidebar-section-header:hover { background: #f9fafb; }
        .sidebar-section-arrow {
            font-size: 10px; color: #9ca3af; transition: transform 0.2s;
            flex-shrink: 0; width: 16px; text-align: center;
        }
        .sidebar-section-body { overflow: hidden; transition: max-height 0.25s ease; }
        .sidebar-section-body.collapsed { max-height: 0 !important; }

        /* 目录容器 */
        .toc-container {
            padding: 0; margin: 0; flex: 1; overflow-y: auto;
            display: flex; flex-direction: column; min-height: 0;
        }
        .toc-tree { padding: 0 8px 8px; }
        .toc-item {
            display: flex; align-items: center; gap: 4px; padding: 5px 8px;
            border-radius: 8px; cursor: pointer; transition: background 0.12s;
            font-size: 13px; color: #374151; line-height: 1.5;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .toc-item:hover { background: #f1f5f9; }
        .toc-item.active { background: #eff6ff; color: #2563eb; font-weight: 600; }
        .toc-toggle {
            flex-shrink: 0; width: 16px; height: 16px; display: flex;
            align-items: center; justify-content: center; font-size: 10px;
            color: #9ca3af; border-radius: 3px; transition: 0.15s;
            user-select: none;
        }
        .toc-toggle:hover { background: #e5e7eb; color: #374151; }
        .toc-toggle.collapsed { transform: rotate(-90deg); }
        .toc-toggle.leaf { visibility: hidden; }
        .toc-text {
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        }
        .toc-children { overflow: hidden; transition: max-height 0.2s ease; }
        .toc-children.collapsed { max-height: 0 !important; }

        /* 文档列表 */
        .doc-list { flex-shrink: 0; }
        .doc-item {
            background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 10px;
            padding: 10px 12px; margin: 0 10px 6px; cursor: pointer; transition: 0.15s;
        }
        .doc-item:hover { background: #eff6ff; border-color: #93c5fd; }
        .doc-item.active { background: #eff6ff; border-color: #3b82f6; }
        .doc-item-title { font-size: 13px; font-weight: 600; color: #1f2937; margin-bottom: 4px;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
        .doc-item-title .doc-title-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .doc-item-rename {
            background: none; border: none; color: #9ca3af; cursor: pointer; font-size: 12px; padding: 0 2px;
            flex-shrink: 0; opacity: 0; transition: opacity 0.15s;
        }
        .doc-item:hover .doc-item-rename { opacity: 1; }
        .doc-item-rename:hover { color: #3b82f6; }
        .doc-item-meta { font-size: 11px; color: #9ca3af; display: flex; justify-content: space-between; align-items: center; }
        .doc-item-del {
            background: none; border: none; color: #d1d5db; cursor: pointer; font-size: 14px; padding: 0 4px;
        }
        .doc-item-del:hover { color: #dc2626; }

        #userInfoArea { padding: 0 16px; }
        /* ===== 登录弹窗 ===== */
        .login-overlay {
            position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 9999;
            display: flex; align-items: center; justify-content: center;
        }
        .login-box {
            background: white; border-radius: 16px; padding: 32px 28px; width: 340px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.25); text-align: center;
        }
        .login-box h2 { font-size: 22px; font-weight: 700; color: #1f2937; margin-bottom: 6px; }
        .login-box p { font-size: 13px; color: #6b7280; margin-bottom: 20px; }
        .login-field { width: 100%; padding: 10px 14px; border: 1px solid #d1d5db; border-radius: 10px;
            font-size: 14px; margin-bottom: 12px; box-sizing: border-box; outline: none; }
        .login-field:focus { border-color: #3b82f6; }
        .login-submit {
            width: 100%; padding: 10px 0; background: #2c5f2d; color: white; border: none;
            border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 4px;
        }
        .login-submit:hover { background: #1f4520; }
        .login-toggle { margin-top: 14px; font-size: 13px; color: #3b82f6; cursor: pointer; }
        .login-toggle:hover { text-decoration: underline; }
        .login-error { color: #dc2626; font-size: 12px; margin-bottom: 8px; min-height: 18px; }

        .style-sidebar {
            position: fixed; right: 0; top: 0; width: 300px; height: 100vh;
            background: #fff; box-shadow: -2px 0 12px rgba(0,0,0,0.1);
            z-index: 1002; padding: 20px; overflow-y: auto;
            font-size: 13px; border-left: 1px solid #e5e7eb;
        }
        .style-sidebar-header {
            display: flex; justify-content: space-between; align-items: center;
            margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid #e5e7eb;
        }
        .style-sidebar-header h3 { font-size: 18px; font-weight: 600; color: #1f2937; }
        .undo-redo-bar { display: flex; gap: 8px; }
        .undo-redo-bar button {
            background: #f3f4f6; border: 1px solid #d1d5db; border-radius: 20px;
            padding: 6px 12px; font-size: 12px; cursor: pointer; transition: 0.1s;
        }
        .undo-redo-bar button:hover:not(:disabled) { background: #e5e7eb; }
        .undo-redo-bar button:disabled { opacity: 0.5; cursor: not-allowed; }
        .sidebar-section { margin-bottom: 20px; }
        .sidebar-section-title { font-size: 12px; font-weight: 600; color: #6b7280; margin-bottom: 12px; letter-spacing: 0.5px; }
        /* ★ 作答区空白预设按钮 */
        .blank-preset-btn:hover { background: #0369a1 !important; color: #fff !important; border-color: #0369a1 !important; }
        .blank-preset-btn.blank-preset-active:hover { background: #0284c7 !important; border-color: #0284c7 !important; }
        .sidebar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
        .sidebar-label { font-size: 12px; color: #4b5563; min-width: 40px; }
        .sidebar-input {
            border: 1px solid #d1d5db; border-radius: 8px; padding: 6px 10px;
            font-size: 12px; outline: none; background: #f9fafb; text-align: center; width: 60px;
        }
        .sidebar-input:focus { border-color: #3b82f6; background: #fff; }
        .sidebar-select {
            border: 1px solid #d1d5db; border-radius: 8px; padding: 4px 8px;
            font-size: 12px; background: #f9fafb; cursor: pointer; flex: 1;
            height: 28px;            /* 新增固定高度 */
            line-height: normal;     /* 避免文字偏下 */

        }
        .sidebar-align-group { display: flex; gap: 2px; background: #f3f4f6; border-radius: 7px; padding: 2px; }
        .sidebar-align-btn {
            width: 26px; height: 26px; border: none; background: transparent; border-radius: 5px;
            cursor: pointer; display: flex; align-items: center; justify-content: center;
            font-size: 12px; color: #4b5563;
        }
        .sidebar-align-btn.active { background: #3b82f6; color: white; }
        .sidebar-style-btn {
            width: 26px; height: 26px; border: 1px solid #d1d5db; background: #f9fafb; border-radius: 6px;
            cursor: pointer; display: flex; align-items: center; justify-content: center;
            font-size: 12px; font-weight: 500; color: #374151; transition: 0.1s;
        }
        .sidebar-style-btn.active { background: #3b82f6; color: white; border-color: #3b82f6; }
        .sidebar-color-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
        .sidebar-color-swatch {
            width: 28px; height: 28px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; transition: 0.1s;
        }
        .sidebar-color-swatch.active { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.3); }
        .sidebar-color-custom {
            width: 28px; height: 28px; border-radius: 6px; border: 2px dashed #9ca3af; cursor: pointer;
            position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center;
            font-size: 16px; color: #6b7280;
        }
        .sidebar-color-custom input { position: absolute; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
        .sidebar-col-group { display: flex; align-items: center; gap: 8px; }
        .sidebar-col-btn { width: 28px; height: 28px; border: 1px solid #d1d5db; background: #f9fafb; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 16px; }
        .sidebar-col-val { font-weight: 600; min-width: 28px; text-align: center; }
        .sidebar-batch-btn {
            width: 100%; padding: 8px 0; background: #f3f4f6; border: 1px solid #e5e7eb;
            border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 500; color: #374151;
            transition: 0.1s; margin-top: 8px;
        }
        .sidebar-batch-btn:hover { background: #e5e7eb; }
        .sidebar-divider { height: 1px; background: #e5e7eb; margin: 16px 0; }
        /* 格式刷按钮 */
        .format-painter-btn {
            flex: 1; padding: 5px 0; background: #f0f9ff; color: #0369a1;
            border: 1px solid #bae6fd; border-radius: 8px; font-size: 12px; font-weight: 600;
            cursor: pointer; transition: 0.15s; white-space: nowrap;
        }
        .format-painter-btn:hover { background: #dbeafe; border-color: #7dd3fc; }
        .format-painter-btn.active {
            background: #0369a1; color: white; border-color: #0369a1;
            animation: pulse-brush 1.2s ease-in-out infinite;
        }
        @keyframes pulse-brush {
            0%, 100% { box-shadow: 0 0 0 0 rgba(3, 105, 161, 0.4); }
            50% { box-shadow: 0 0 0 6px rgba(3, 105, 161, 0); }
        }
        /* 格式刷模式下的页面光标 */
        body.format-painter-active .a4-page * { cursor: copy !important; }
        body.format-painter-active .a4-page { cursor: copy !important; }
        body.format-painter-active .a4-page [data-node-id]:hover {
            outline: 2px dashed #0369a1 !important;
            outline-offset: 2px;
            transition: outline 0.1s;
        }
        /* 格式刷提示浮层 */
        .format-painter-toast {
            position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
            background: #0369a1; color: white; padding: 10px 24px; border-radius: 20px;
            font-size: 14px; font-weight: 600; z-index: 10000;
            box-shadow: 0 8px 24px rgba(3, 105, 161, 0.3);
            pointer-events: none; animation: slideDown 0.25s ease;
        }
        @keyframes slideDown {
            from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
            to { opacity: 1; transform: translateX(-50%) translateY(0); }
        }
        .sidebar-placeholder { color: #9ca3af; text-align: center; padding: 40px 20px; font-size: 14px; }
        .font-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
        .font-btn { padding: 4px 8px; border: 1px solid #d1d5db; background: #f9fafb; border-radius: 6px; cursor: pointer; font-size: 12px; }
        .font-btn.active { background: #3b82f6; color: white; border-color: #3b82f6; }
        .number-control { display: flex; align-items: center; gap: 4px; }
        .number-control button { width: 28px; height: 28px; border: 1px solid #d1d5db; background: #f9fafb; border-radius: 6px; cursor: pointer; font-size: 16px; font-weight: bold; }
        .number-control input { width: 50px; text-align: center; background: #f9fafb; border: 1px solid #d1d5db; border-radius: 6px; padding: 4px; font-size: 12px; }
        .page-header, .page-footer { user-select: none; cursor: pointer; }
        .page-header:hover, .page-footer:hover { background: rgba(59,130,246,0.05); outline: 1px dashed #3b82f6; }
        .page-header { border-bottom: 1px solid #e5e7eb; margin-bottom: 12px; padding-bottom: 8px; }
        .page-footer { border-top: 1px solid #e5e7eb; margin-top: 12px; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; }
        .page-number { cursor: pointer; }
        .page-number:hover { background: rgba(59,130,246,0.05); outline: 1px dashed #3b82f6; }
        .layout-element-selected { outline: 2px solid #3b82f6 !important; background: rgba(59,130,246,0.06) !important; }
        .dot { display: inline-block; position: relative; text-decoration: none; }
        .dot::after {
            content: "·"; position: absolute; bottom: 0; left: 0; right: 0;
            text-align: center; font-size: 1.2em; line-height: 0; color: currentColor; pointer-events: none;
        }
/* ==================== 自由布局专用样式 ==================== */
.free-layout-page {
    overflow: visible; /* 允许手柄超出边界 */
}

.free-content-area {
    /* 内容区绝对定位原点 */
}

[data-node-id] .free-drag-handle,
[data-node-id] .free-resize-handle {
    /* 手柄默认隐藏，hover时显示（已在JS中控制） */
}

/* 拖拽中：禁止文字选中 */
body.dragging-node {
    user-select: none;
    -webkit-user-select: none;
}

/* 节点被拖拽时的目标页高亮 */
.free-content-area.drag-target {
    outline: 2px dashed rgba(59,130,246,0.4);
    outline-offset: -4px;
    border-radius: 4px;
}

/* 对齐参考线（可选） */
.free-snap-line {
    position: absolute;
    background: rgba(59,130,246,0.5);
    pointer-events: none;
    z-index: 999;
}
.free-snap-line.horizontal {
    height: 1px;
    left: 0;
    right: 0;
}
.free-snap-line.vertical {
    width: 1px;
    top: 0;
    bottom: 0;
}

        /* ===== 编号样式面板 ===== */
        .numbering-panel {
            background: #f0f9ff;
            border: 1px solid #bae6fd;
            border-radius: 10px;
            padding: 12px;
            margin-bottom: 4px;
        }
        .numbering-toggle-row {
            display: flex; align-items: center; justify-content: space-between;
            margin-bottom: 8px;
        }
        .numbering-toggle-label { font-size: 12px; font-weight: 600; color: #0369a1; }
        .toggle-switch {
            position: relative; width: 36px; height: 20px;
        }
        .toggle-switch input { opacity: 0; width: 0; height: 0; }
        .toggle-slider {
            position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
            background-color: #cbd5e1; border-radius: 20px; transition: .3s;
        }
        .toggle-slider:before {
            position: absolute; content: ""; height: 14px; width: 14px;
            left: 3px; bottom: 3px; background-color: white; border-radius: 50%; transition: .3s;
        }
        .toggle-switch input:checked + .toggle-slider { background-color: #3b82f6; }
        .toggle-switch input:checked + .toggle-slider:before { transform: translateX(16px); }
        .numbering-options { display: none; flex-direction: column; gap: 8px; }
        .numbering-options.visible { display: flex; }
        .num-style-grid {
            display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
        }
        .num-style-btn {
            padding: 5px 4px; border: 1px solid #d1d5db; background: #f9fafb;
            border-radius: 6px; cursor: pointer; font-size: 11px; text-align: center;
            transition: 0.1s; color: #374151;
        }
        .num-style-btn.active { background: #3b82f6; color: white; border-color: #3b82f6; }
        .num-start-row { display: flex; align-items: center; gap: 8px; }
        .num-start-row label { font-size: 11px; color: #6b7280; }
        .num-start-input {
            width: 48px; text-align: center; border: 1px solid #d1d5db;
            border-radius: 6px; padding: 3px 4px; font-size: 12px;
        }
        .num-batch-section {
            background: #fefce8; border: 1px solid #fde047;
            border-radius: 8px; padding: 10px; margin-top: 4px;
        }
        .num-batch-title { font-size: 11px; font-weight: 600; color: #854d0e; margin-bottom: 8px; }
        .num-batch-btn-row { display: flex; gap: 4px; flex-wrap: wrap; }
        .num-batch-small {
            padding: 4px 8px; border: 1px solid #d1d5db; background: #fff;
            border-radius: 6px; cursor: pointer; font-size: 11px; color: #374151;
            transition: 0.1s; flex: 1; text-align: center;
        }
        .num-batch-small:hover { background: #fef9c3; border-color: #fbbf24; }
        .num-level-batch {
            background: #f0fdf4; border: 1px solid #86efac;
            border-radius: 8px; padding: 10px; margin-top: 4px;
        }
        .num-level-title { font-size: 11px; font-weight: 600; color: #166534; margin-bottom: 8px; }
        .num-level-btn-row { display: flex; gap: 4px; flex-wrap: wrap; }
        .num-level-btn {
            padding: 4px 8px; border: 1px solid #86efac; background: #fff;
            border-radius: 6px; cursor: pointer; font-size: 11px; color: #166534;
            transition: 0.1s; flex: 1; text-align: center;
        }
        .num-level-btn:hover { background: #dcfce7; }

        /* 编辑中高亮提示 */
        .editing-highlight {
            outline: 2px solid #3b82f6 !important;
            background: #eff6ff !important;
            border-radius: 4px;
        }

        /* 加点字样式 */
        .dot-char {
            display: inline;
            position: relative;
        }
        .dot-char::after {
            content: '';
            position: absolute;
            left: 50%;
            bottom: -3px;
            transform: translateX(-50%);
            width: 3px;
            height: 3px;
            border-radius: 50%;
            background: currentColor;
            pointer-events: none;
        }
        /* 网格内加点：伪元素方案无需额外补偿 */
        .grid-item .dot-char {
            margin-bottom: 0;
        }
        /* 括号前的题干文字 */
        .choice-prefix {
            display: inline;
            line-height: inherit;
        }

        /* 括号题整体：作为一个稳定的行内块，给√预留下方空间 */
        .choice-group {
            display: inline-block;
            vertical-align: baseline;
            position: relative;
            padding-bottom: 1.15em; /* 给下面的√单独留空间 */
            line-height: inherit;
        }

        /* 普通段落里的括号题 */
        .paragraph-node .choice-group {
            padding-bottom: 1.15em;
        }

        /* 网格里的括号题：稍微多留一点，避免拼音挤压 */
        .grid-item .choice-group {
            padding-bottom: 1.2em;
        }
        /* 网格内括号题含田字格/拼音时，取消额外底部padding，避免大空白 */
        .grid-item .choice-group:has(.inline-tz-item),
        .grid-item .choice-group:has(ruby.inline-py-group) {
            padding-bottom: 0;
        }

        /* 正确选项和普通选项都作为独立的小列来排 */
        .choice-correct-wrap,
        .choice-option-wrap {
            position: relative;
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            line-height: inherit;
            cursor: inherit;
            vertical-align: top;
            min-width: 1em;
        }

        /* √：绝对放到选项文字下面，不参与当前行文字对齐 */
        .choice-check-abs {
            position: absolute;
            top: calc(100% + 0.22em);
            left: 50%;
            transform: translateX(-50%);
            line-height: 1;
            pointer-events: none;
            white-space: nowrap;
            color: var(--choice-check-color, currentColor);
            font-size: 0.9em;
        }

        /* hover 提示的淡色√，位置和正式√保持一致 */
        .choice-option-wrap:hover::after {
            content: '√';
            position: absolute;
            top: calc(100% + 0.22em);
            left: 50%;
            transform: translateX(-50%);
            color: #aaa;
            font-size: 0.85em;
            line-height: 1;
            pointer-events: none;
        }

        /* 有√时 hover 只是稍微变淡 */
        .choice-correct-wrap:hover .choice-check-abs {
            opacity: 0.6;
        }
        /* 隐藏答案时√也隐藏 */
        .hide-answer .choice-check-abs {
            visibility: hidden;
        }
        /* 括号题整体：作为一个稳定的行内块，给√预留下方空间 */
        .choice-group {
            display: inline-flex;
            align-items: flex-start;
            vertical-align: top;
            position: relative;
            padding-bottom: 1.15em; /* 给下面的√单独留空间 */
        }

        /* 普通段落里的括号题 */
        .paragraph-node .choice-group {
            padding-bottom: 1.15em;
        }

        /* 网格里的括号题：稍微多留一点，避免拼音挤压 */
        .grid-item .choice-group {
            padding-bottom: 1.2em;
        }
        /* 网格内括号题含田字格/拼音时，取消额外底部padding，避免大空白 */
        .grid-item .choice-group:has(.inline-tz-item),
        .grid-item .choice-group:has(ruby.inline-py-group) {
            padding-bottom: 0;
        }

        /* 正确选项和普通选项都作为独立的小列来排 */
        .choice-correct-wrap,
        .choice-option-wrap {
            position: relative;
            display: inline-block;
            line-height: inherit;
            cursor: inherit;
            vertical-align: baseline;
            min-width: 1em;
            text-align: center;
        }

        /* √：绝对放到选项文字下面，不参与当前行文字对齐 */
        .choice-check-abs {
            position: absolute;
            top: calc(100% + 0.22em);
            left: 50%;
            transform: translateX(-50%);
            line-height: 1;
            pointer-events: none;
            white-space: nowrap;
            color: var(--choice-check-color, currentColor);
            font-size: 0.9em;
        }

        /* hover 提示的淡色√，位置和正式√保持一致 */
        .choice-option-wrap:hover::after {
            content: '√';
            position: absolute;
            top: calc(100% + 0.22em);
            left: 50%;
            transform: translateX(-50%);
            color: #aaa;
            font-size: 0.85em;
            line-height: 1;
            pointer-events: none;
        }

        /* 有√时 hover 只是稍微变淡 */
        .choice-correct-wrap:hover .choice-check-abs {
            opacity: 0.6;
        }
        /* ==================== 文字选中工具条 ==================== */
        .text-toolbar {
            position: fixed;
            z-index: 99999;
            background: #1f2937;
            border-radius: 10px;
            padding: 6px 8px;
            display: flex;
            align-items: center;
            gap: 2px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.35);
            user-select: none;
            flex-wrap: wrap;
            max-width: 480px;
        }
        .text-toolbar::after {
            content: '';
            position: absolute;
            bottom: -6px;
            left: 50%;
            transform: translateX(-50%);
            border: 6px solid transparent;
            border-bottom: none;
            border-top-color: #1f2937;
        }
        .tb-btn {
            background: transparent;
            border: none;
            color: #e5e7eb;
            padding: 5px 8px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            white-space: nowrap;
            transition: background 0.15s;
            display: flex;
            align-items: center;
            gap: 3px;
        }
        .tb-btn:hover { background: #374151; }
        .tb-btn.active { background: #3b82f6; color: white; }
        .tb-btn.danger:hover { background: #7f1d1d; }
        .tb-sep {
            width: 1px;
            height: 20px;
            background: #374151;
            margin: 0 2px;
            flex-shrink: 0;
        }
        .tb-label {
            font-size: 10px;
            color: #6b7280;
            padding: 0 4px;
            white-space: nowrap;
        }
        .tb-submenu {
            position: fixed;
            z-index: 100000;
            background: #ffffff;
            border: 1px solid #e5e7eb;
            border-radius: 10px;
            padding: 6px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 4px;
            min-width: 200px;
        }
        .tb-sub-btn {
            background: #f9fafb;
            border: 1px solid #e5e7eb;
            color: #374151;
            padding: 6px 10px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            text-align: center;
            transition: background 0.15s;
            white-space: nowrap;
        }
        .tb-sub-btn:hover { background: #f3f4f6; border-color: #d1d5db; }
        .tb-answer-btn:hover { background: #374151; }
        .inline-dot {
            display: inline;
            text-emphasis: filled circle;
            -webkit-text-emphasis: filled circle;
            text-emphasis-position: under right;
            -webkit-text-emphasis-position: under right;
        }
        .inline-answer-blank {
            display: inline;
            border-bottom: 1.2px solid currentColor;
            color: #c0392b;
        }
        .inline-answer-paren {
            display: inline;
            color: #c0392b;
        }

        /* ===== 答案容器内的下划线span：只保留装饰效果，不改变布局 ===== */
        .answer-inline [class*="inline-ul"],
        .answer-blank [class*="inline-ul"],
        .answer-below-line [class*="inline-ul"],
        .choice-text [class*="inline-ul"] {
            display: inline !important;
            vertical-align: baseline !important;
            line-height: inherit !important;
            padding: 0 !important;
            margin: 0 !important;
            text-underline-offset: 4px !important;
        }
        .inline-ul-solid { text-decoration: underline solid; text-decoration-thickness: 1px; text-underline-offset: 4px; }
        .inline-ul-double { text-decoration: underline double; text-decoration-thickness: 1px; text-underline-offset: 4px; }
        .inline-ul-dotted { text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: 4px; }
        .inline-ul-dashed { text-decoration: underline dashed; text-decoration-thickness: 1px; text-underline-offset: 4px; }
        .inline-ul-wavy { text-decoration: underline wavy; text-decoration-thickness: 1px; text-underline-offset: 6px; }
        .inline-ul-thick { text-decoration: underline solid; text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
        .inline-ul-overline { text-decoration: overline solid; text-decoration-thickness: 1px; }
        .inline-ul-through { text-decoration: line-through solid; text-decoration-thickness: 1px; }

        /* ==================== AI校对面板 ==================== */
        .proof-panel {
            position: fixed;
            right: 310px;
            top: 80px;
            width: 340px;
            max-height: 70vh;
            background: white;
            border: 1px solid #e5e7eb;
            border-radius: 14px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.15);
            z-index: 2000;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            font-size: 13px;
        }
        .proof-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 16px;
            background: #f0fdf4;
            border-bottom: 1px solid #bbf7d0;
            font-weight: 600;
            color: #166534;
            flex-shrink: 0;
        }
        .proof-close {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 16px;
            color: #6b7280;
            padding: 0 4px;
        }
        .proof-close:hover { color: #dc2626; }
        .proof-actions {
            padding: 8px 12px;
            border-bottom: 1px solid #f3f4f6;
            flex-shrink: 0;
        }
        .proof-fix-all {
            width: 100%;
            padding: 7px;
            background: #dcfce7;
            border: 1px solid #86efac;
            border-radius: 8px;
            color: #166534;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
        }
        .proof-fix-all:hover { background: #bbf7d0; }
        .proof-list {
            overflow-y: auto;
            flex: 1;
            padding: 8px 10px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        .proof-empty {
            padding: 32px;
            text-align: center;
            color: #16a34a;
            font-size: 15px;
            font-weight: 500;
        }
        .proof-item {
            background: #fafafa;
            border: 1px solid #e5e7eb;
            border-radius: 10px;
            padding: 10px 12px;
        }
        .proof-item-header {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-bottom: 5px;
        }
        .proof-type-badge {
            font-size: 11px;
            font-weight: 600;
            padding: 2px 7px;
            border-radius: 20px;
            border: 1px solid;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .proof-location {
            font-size: 12px;
            color: #6b7280;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .proof-problem {
            font-size: 12px;
            color: #374151;
            margin-bottom: 4px;
            line-height: 1.5;
        }
        .proof-suggestion {
            font-size: 12px;
            color: #059669;
            font-weight: 500;
            margin-bottom: 6px;
        }
        .proof-item-actions {
            display: flex;
            gap: 6px;
            align-items: center;
        }
        .proof-locate, .proof-fix, .proof-ignore {
            padding: 3px 10px;
            border-radius: 6px;
            border: 1px solid #d1d5db;
            font-size: 12px;
            cursor: pointer;
            background: #f9fafb;
            color: #374151;
        }
        .proof-locate:hover { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
        .proof-fix { background: #f0fdf4; border-color: #86efac; color: #166534; font-weight: 600; }
        .proof-fix:hover { background: #dcfce7; }
        .proof-ignore:hover { background: #fff1f2; border-color: #fca5a5; color: #dc2626; }
        .proof-manual { font-size: 11px; color: #9ca3af; }

        /* ===== 工具条答案span：隐藏时透明但保留占位和下划线形状 ===== */
        [data-role="answer"] {
            display: inline;
            position: relative;
            text-decoration: underline;
            text-decoration-thickness: 1.2px;
            text-underline-offset: 4px;
        }
        [data-role="answer"].no-answer-ul {
            text-decoration: none;
        }

        /* 隐藏答案时：文字透明，但下划线/边框颜色保留 */
        .hide-answer [data-role="answer"],
        .hide-answer [data-role="answer"] * {
            color: transparent !important;
        }
        .hide-answer [data-role="answer"]:not(.no-answer-ul) {
            text-decoration-color: #555 !important;
        }

        /* 隐藏答案时：小方格内答案文字也透明 */
        .hide-answer .square-box-cell {
            color: transparent !important;
        }

        /* ★ 新增：隐藏答案时，打√题的√也隐藏 */
        .hide-answer .choice-check-abs {
            visibility: hidden;
        }
        /* ★ 新增：隐藏答案时，hover提示也不显示 */
        .hide-answer .choice-option-wrap:hover::after {
            display: none;
        }

        /* 保留下划线可见（下划线颜色不跟随color透明） */
        .hide-answer [data-role="answer"] span[class*="inline-ul"] {
            text-decoration-color: #aaa !important;
        }

        /* 隐藏答案时，田字格上方拼音依然保持可见 */
        .hide-answer .inline-tz-pinyin {
            visibility: visible !important;
            color: #333 !important;
        }

        /* 画√：inline-check-mark 只是标记用，实际显示交给渲染 */
        .inline-check-mark {
            display: inline;
            /* 不设颜色，由渲染逻辑控制 */
        }

        /* ==================== 行内田字格（段落/网格混排） ==================== */
        /* 修改后 */
        ruby.inline-py-group {
            ruby-align: center;
            display: inline-ruby;
            margin: 0 0.5px;
            line-height: 2;   /* 给 rt 留出足够空间，自然撑高行高 */
        }
        ruby.inline-py-group rb {
            font-size: inherit;
            line-height: inherit;
        }
        ruby.inline-py-group rt {
            font-size: 0.48em;
            line-height: 1;
            color: var(--pinyin-color, #888888);
            font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
            letter-spacing: 0.2px;
            ruby-position: over;
            padding-bottom: 0.15em;
            opacity: 0.55;
        }
        @media print {
            ruby.inline-py-group rt {
                color: var(--pinyin-color, #000) !important;
                opacity: 0.55 !important;
            }
        }
        /* 网格内拼音：覆盖行高和垂直对齐，防止文字因 line-height:2 上飘 */
        .grid-item ruby.inline-py-group {
            vertical-align: bottom;
            line-height: normal;
        }

        .grid-item .inline-tz-item {
            vertical-align: middle;
            transform: translateY(-0.5em);
            align-items: center;
        }
        .paragraph-node .inline-tz-item {
            vertical-align: middle;
            transform: translateY(-0.5em);
            align-items: center;
        }

        /* 答案 span 内的田字格：与整行文字中间对齐，translateY 微调弥补拼音额外高度 */
        .paragraph-node .answer-inline .inline-tz-item,
        .paragraph-node .answer-blank .inline-tz-item,
        .answer-below-line .inline-tz-item,
        .answer-inline .inline-tz-item,
        .answer-blank .inline-tz-item {
            vertical-align: middle;
            transform: translateY(-0.5em);
            align-items: center;
        }
        /* 答案横线区域若已改为田字格，自动取消下划线 */
        .answer-blank:has(.inline-tz-item) {
            text-decoration: none !important;
            padding: 0;
        }
        /* below 模式答案行：含田字格时自动隐藏横线 */
        .inline-tz-item {
            display: inline-flex;
            flex-direction: column;
            align-items: center;
            gap: 2px;
            justify-content: flex-start;
            position: relative;
            text-indent: 0;
            vertical-align: middle;
            margin: 0 1.5px;
        }

        .inline-tz-pinyin {
            font-size: 0.65em;
            line-height: 1;
            white-space: nowrap;
            color: inherit;
            font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
            letter-spacing: normal;
            text-align: center;
            pointer-events: none;
            min-height: 1em;  /* 无拼音时也占位，保持对齐 */
            text-indent: 0;
        }
        .inline-tz-box {
            width: 1.6em;
            height: 1.6em;
            border: 1.5px solid #555;
            position: relative;
            box-sizing: border-box;
            border-radius: 2px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: inherit;
            flex-shrink: 0;
            text-indent: 0;
        }
        .inline-tz-box::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 0;
            right: 0;
            border-top: 1px dashed #bbb;
            pointer-events: none;
        }
        .inline-tz-box::after {
            content: '';
            position: absolute;
            left: 50%;
            top: 0;
            bottom: 0;
            border-left: 1px dashed #bbb;
            pointer-events: none;
        }
        .inline-tz-char {
            position: relative;
            z-index: 1;
            line-height: 1;
            color: inherit;
            transition: color 0.15s;
            text-indent: 0;
        }
        .inline-tz-pinyin-edit {
            outline: none;
            border-bottom: 1px dashed #3b82f6;
            min-width: 1em;
            cursor: text;
            color: #1d4ed8;
        }
        /* 打印时保留行内田字格 */
        @media print {
            .inline-tz-box { border-color: #333 !important; }
            .inline-tz-box::before { border-color: #bbb !important; }
            .inline-tz-box::after { border-color: #bbb !important; }
        }

        /* ==================== 田字格 ==================== */
        .tianzige-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
            padding: 4px 6px;
        }
        .tianzige-pinyin {
            font-size: 12px;
            color: #444;
            text-align: center;
            white-space: nowrap;
            line-height: 1.4;
            letter-spacing: 0.5px;
            padding-right: 0.5px;
            font-family: 'Times New Roman', 'Noto Serif', 'SimSun', serif;
            font-style: normal;
        }
        .tianzige-boxes {
            display: flex;
            gap: 0px;
            align-items: flex-end;
        }
        .tianzige-char-unit {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1px;
        }
        .tianzige-box {
            width: 52px;
            height: 52px;
            border: 1.5px solid #555;
            position: relative;
            box-sizing: border-box;
            border-radius: 2px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 33.6px;
            color: #c0392b;
            text-indent: 0;
        }
        /* 横中线 */
        .tianzige-box::before {
            content: '';
            position: absolute;
            top: 50%;
            left: 0;
            right: 0;
            border-top: 1px dashed #bbb;
            pointer-events: none;
        }
        /* 竖中线 */
        .tianzige-box::after {
            content: '';
            position: absolute;
            left: 50%;
            top: 0;
            bottom: 0;
            border-left: 1px dashed #bbb;
            pointer-events: none;
        }
        .tianzige-box .tianzige-char {
            position: relative;
            z-index: 1;
            line-height: 1;
            transition: color 0.15s;
        }
        /* 打印时保留田字格 */
        @media print {
            .tianzige-box { border-color: #333 !important; }
            .tianzige-box::before { border-color: #bbb !important; }
            .tianzige-box::after { border-color: #bbb !important; }
        }

        /* ===== 作文小方格 ===== */
        .square-box-grid {
            --grid-color: #3b82f6;
            display: flex;
            flex-direction: column;
            gap: 0;
            width: fit-content;
            border-top: 1px solid var(--grid-color);
            border-left: 1px solid var(--grid-color);
        }
        .square-box-row {
            display: flex;
            gap: 0;
        }
        .square-box-cell {
            width: 28px;
            height: 28px;
            border-right: 1px solid var(--grid-color);
            border-bottom: 1px solid var(--grid-color);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            line-height: 1;
            box-sizing: border-box;
            flex-shrink: 0;
            color: #c0392b;
            font-family: '楷体', 'KaiTi', '华文楷体', 'Noto Serif CJK SC', serif;
            background: #fff;
            cursor: text;
            outline: none;
            text-align: center;
            caret-color: #3b82f6;
        }
        .square-box-cell.empty {
            color: transparent;
        }
        .square-box-cell[contenteditable="true"] {
            background: #eff6ff;
            box-shadow: inset 0 0 0 1.5px #3b82f6;
            z-index: 2;
            position: relative;
        }
        /* 小方格右上角 "+1" 按钮 — 默认隐藏，选中节点后显示 */
        .square-box-add-row {
            position: absolute;
            right: 0;
            top: -30px;
            opacity: 0;
            pointer-events: none;
            z-index: 12;
            transition: opacity 0.15s;
        }
        [data-node-id].node-selected .square-box-add-row {
            opacity: 1;
            pointer-events: auto;
        }
        .square-box-add-row button {
            padding: 2px 9px;
            border: 1px solid #f59e0b;
            background: #fffbeb;
            border-radius: 4px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 700;
            color: #b45309;
            box-shadow: 0 2px 6px rgba(0,0,0,0.12);
            line-height: 1.5;
        }
        .square-box-add-row button:hover {
            background: #fef3c7;
        }
        /* 打印时保留小方格 */
        @media print {
            .square-box-grid { --grid-color: #333 !important; }
            .square-box-cell { border-color: var(--grid-color) !important; }
        }

        /* ===== 浮动操作按钮栏 ===== */
        .floating-action-bar {
            position: fixed;
            right: 308px;
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 14px;
            z-index: 1003;
            padding: 16px 0;
        }
        .fab-item {
            position: relative;
            display: flex;
            align-items: center;
        }
        /* 按钮样式：统一圆形，大小一致 */
        .fab-btn {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            padding: 0;
            font-size: 22px;      /* 图标大小 */
            font-weight: normal;
            color: inherit;
            text-shadow: none;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 0 3px 12px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.08);
            position: relative;
            outline: none;
            background: white; /* 会由具体类覆盖 */
        }
        .fab-btn:hover {
            transform: scale(1.1);
            box-shadow: 0 6px 24px rgba(0,0,0,0.2);
        }
        .fab-btn:active { transform: scale(0.95); }

        /* 各按钮保留原有的渐变背景色（可选，也可统一） */
        .fab-btn.fab-tz     { background: linear-gradient(135deg, #e0f2fe, #bae6fd); color: #0369a1; }
        .fab-btn.fab-num    { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }
        .fab-btn.fab-proof  { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #065f46; }
        .fab-btn.fab-pdf    { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #3730a3; }
        .fab-btn.fab-img    { background: linear-gradient(135deg, #f3e8ff, #e9d5ff); color: #6b21a8; }
        .fab-btn.fab-split  { background: linear-gradient(135deg, #fff7ed, #fed7aa); color: #9a3412; }
        .fab-btn.fab-merge  { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #3730a3; }
        .fab-btn.fab-active { box-shadow: 0 0 0 3px rgba(59,130,246,0.4), 0 6px 24px rgba(0,0,0,0.2); }

        /* 浮动按钮栏：整体向左移动（增大 right 值，使按钮远离右边缘） */
        .floating-action-bar {
            position: fixed;
            right: 385px;      /* 原 308px → 改为 360px，向左移动了 52px */
            top: 50%;
            transform: translateY(-50%);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 14px;
            z-index: 1003;
            padding: 16px 0;
        }
        /* 新增：提示框容器样式（黑底白字，快速显示） */
        .fab-tooltip {
            position: absolute;
            right: 100%;
            top: 50%;
            transform: translateY(-50%);
            margin-right: 10px;
            background: #000000;
            color: #ffffff;
            font-size: 12px;
            white-space: nowrap;
            padding: 4px 10px;
            border-radius: 6px;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.08s ease, visibility 0.08s ease;
            pointer-events: none;
            z-index: 10000;
            box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        }
        .fab-item:hover .fab-tooltip {
            opacity: 1;
            visibility: visible;
        }
        .fab-tooltip::after {
            content: '';
            position: absolute;
            left: 100%;
            top: 50%;
            transform: translateY(-50%);
            border: 5px solid transparent;
            border-left-color: #000000;
            border-right: none;
        }
        .fab-panel {
            position: fixed;
            width: 310px;
            max-height: 70vh;
            overflow-y: auto;
            background: white;
            border: 1px solid #e5e7eb;
            border-radius: 14px;
            box-shadow: 0 12px 40px rgba(0,0,0,0.18);
            padding: 16px;
            z-index: 2000;
            display: none;
            font-size: 13px;
        }
        .fab-panel.open { display: block; }
        .fab-panel::-webkit-scrollbar { width: 4px; }
        .fab-panel::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

        /* 导出面板：定位在浮动按钮左侧 */
        #exportPanel {
            position: absolute;
            right: 58px;
            top: 50%;
            transform: translateY(-50%);
            width: 190px;
            max-height: none;
            overflow-y: visible;
            padding: 10px;
        }

        @media print {
            @page {
                size: A4 portrait;
                margin: 0;
            }

            html, body {
                background: #fff !important;
                margin: 0 !important;
                padding: 0 !important;
                padding-left: 0 !important;
                padding-right: 0 !important;
                overflow: visible !important;
                -webkit-print-color-adjust: exact;
                print-color-adjust: exact;
            }

            body.printing,
            body.printing * {
                animation: none !important;
                transition: none !important;
                caret-color: transparent !important;
            }

            .api-bar,
            .paste-area,
            .export-bar,
            .top-fixed-toolbar,
            .style-sidebar,
            .btn-primary,
            .undo-redo-bar,
            .floating-action-bar,
            .fab-panel,
            .left-sidebar,
            .login-overlay,
            #templateOverlay,
            #templatePreviewOverlay,
            .text-toolbar,
            .tb-submenu,
            .context-menu,
            .proof-panel,
            .sidebar-placeholder,
            .sidebar-footer,
            #sidebarFooter,
            #styleSidebar,
            .toolbar-dropdown-panel,
            .multi-select-toolbar,
            .selection-box,
            .fab-tooltip,
            .import-modal-overlay,
            .loading-overlay {
                display: none !important;
                visibility: hidden !important;
            }

            .pages-container {
                background: #fff !important;
                padding: 0 !important;
                margin: 0 !important;
                gap: 0 !important;
                box-shadow: none !important;
                border-radius: 0 !important;
            }

            .a4-page {
                box-shadow: none !important;
                border: none !important;
                border-radius: 0 !important;
                margin: 0 auto !important;
                background: #fff !important;
                break-after: page !important;
                page-break-after: always !important;
                width: 210mm !important;
                height: 1122px !important;
                min-height: 1122px !important;
            }

            .a4-page:last-child {
                break-after: auto !important;
                page-break-after: auto !important;
            }

            .page-footer {
                margin-top: 0 !important;
                padding-top: 0 !important;
            }

            /* 自由布局打印：绝对定位节点正常保留 */
            .free-content-area {
                position: absolute !important;
                overflow: hidden !important;
            }

            [data-node-id] {
                position: absolute !important;
                box-shadow: none !important;
            }

            /* 隐藏拖拽手柄 / 调整手柄 / 辅助线 */
            .free-drag-handle,
            .free-resize-handle,
            .col-resizer,
            .free-snap-line,
            .image-corner-handle,
            .image-rotate-handle {
                display: none !important;
                visibility: hidden !important;
            }
            /* 去掉选中态，避免蓝框和白块 */
            [data-node-id].node-selected {
                background: transparent !important;
                outline: none !important;
                border-radius: 0 !important;
            }

            .raw-text-badge {
                display: none !important;
            }

            /* 参考线不打印 */
            .free-layout-page > div:last-of-type[style*="height: 1px"] {
                display: none !important;
            }

            /* 压掉可能导致“白色长条 / 圆角白框”的伪元素 */
            [data-node-id]::before,
            [data-node-id]::after,
            .layout-element::before,
            .layout-element::after,
            .node-selected::before,
            .node-selected::after {
                content: none !important;
                display: none !important;
            }

            /* 压掉屏幕态卡片效果 */
            .grid-node,
            .paragraph-node,
            .raw-text-node,
            .grid-item,
            .item-content {
                box-shadow: none !important;
            }

            /* 避免空包装层打印出白底块 */
            [data-node-id]:empty {
                background: transparent !important;
                border: none !important;
                min-height: 0 !important;
            }

            /* 兼容QQ浏览器等不支持synthetic bold的打印引擎 */
            .print-bold {
                text-shadow: 0.3px 0 0 currentColor, -0.3px 0 0 currentColor;
            }
        }

        /* 打印时通过 body.printing 类强制隐藏所有 UI 元素 */
        body.printing #styleSidebar,
        body.printing .style-sidebar,
        body.printing #leftSidebar,
        body.printing .left-sidebar,
        body.printing #floatingActionBar,
        body.printing .floating-action-bar,
        body.printing #exportBar,
        body.printing .top-fixed-toolbar,
        body.printing .context-menu,
        body.printing .text-toolbar,
        body.printing .tb-submenu,
        body.printing .proof-panel,
        body.printing .fab-panel,
        body.printing .toolbar-dropdown-panel,
        body.printing .multi-select-toolbar,
        body.printing .selection-box,
        body.printing .fab-tooltip,
        body.printing .import-modal-overlay,
        body.printing .loading-overlay,
        body.printing #templateOverlay,
        body.printing #templatePreviewOverlay,
        body.printing #loginOverlay,
        body.printing #rechargeOverlay,
        body.printing #friendlyErrorModal,
        body.printing #profileModalOverlay,
        body.printing #subModalOverlay,
        body.printing #withdrawModalOverlay,
        body.printing #importModalOverlay {
            display: none !important;
            visibility: hidden !important;
        }
        /* 间距设置面板 */
        .spacing-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-top: 6px;
        }
        .spacing-item {
            display: flex;
            flex-direction: column;
            gap: 3px;
        }
        .spacing-item label {
            font-size: 11px;
            color: #666;
        }
        .spacing-input {
            width: 100%;
            padding: 3px 6px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 12px;
            box-sizing: border-box;
        }
        .spacing-input:focus {
            outline: none;
            border-color: #4a90d9;
        }

        .flat-check {
            display: inline-block;
            width: 1em;
            height: 0.4em;
            border-left: 2px solid currentColor;
            border-bottom: 2px solid currentColor;
            transform: rotate(-45deg) translate(0.1em, -0.12em);
            box-sizing: border-box;
        }

        /* 隐藏 spinner-input 的原生步进按钮（避免与外部自定义按钮重复） */
        .spinner-input::-webkit-outer-spin-button,
        .spinner-input::-webkit-inner-spin-button {
            -webkit-appearance: none;
            margin: 0;
        }
        .spinner-input[type="number"] {
            -moz-appearance: textfield;  /* Firefox 兼容 */
        }

        /* ==================== 右键菜单 ==================== */
        .context-menu {
            position: fixed;
            z-index: 9999;
            background: white;
            border: 1px solid #e5e7eb;
            border-radius: 10px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.15);
            padding: 6px 0;
            min-width: 180px;
            font-size: 13px;
            user-select: none;
        }
        .context-menu-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 16px;
            cursor: pointer;
            color: #374151;
            transition: background 0.1s;
        }
        .context-menu-item:hover {
            background: #f3f4f6;
        }
        .context-menu-item.danger {
            color: #dc2626;
        }
        .context-menu-item.danger:hover {
            background: #fff1f2;
        }
        .context-menu-item.disabled {
            color: #9ca3af;
            cursor: not-allowed;
        }
        .context-menu-item.disabled:hover {
            background: transparent;
        }
        .context-menu-divider {
            height: 1px;
            background: #e5e7eb;
            margin: 4px 0;
        }
        .context-menu-section {
            padding: 2px 12px 4px;
            font-size: 11px;
            color: #9ca3af;
            font-weight: 600;
            letter-spacing: 0.5px;
        }

        /* ==================== 导入进度弹窗 ==================== */
        .import-modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(15, 23, 42, 0.15);
            z-index: 9998;
            display: flex;
            align-items: center;
            justify-content: center;
            animation: fadeIn 0.2s ease;
        }
        @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

        .import-modal {
            background: white;
            border-radius: 20px;
            padding: 32px 36px;
            width: 520px;
            max-width: 90vw;
            box-shadow: 0 24px 60px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.05);
            position: relative;
            animation: slideUp 0.25s ease;
        }
        @keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

        .import-modal-title {
            font-size: 18px;
            font-weight: 700;
            color: #1f2937;
            margin-bottom: 6px;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .import-modal-subtitle {
            font-size: 13px;
            color: #6b7280;
            margin-bottom: 24px;
        }

        /* 步骤指示器 */
        .import-steps {
            display: flex;
            align-items: center;
            gap: 0;
            margin-bottom: 24px;
        }
        .import-step-item {
            display: flex;
            align-items: center;
            gap: 8px;
            flex: 1;
        }
        .import-step-dot {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: 700;
            flex-shrink: 0;
            transition: all 0.3s;
        }
        .import-step-dot.pending {
            background: #f3f4f6;
            color: #9ca3af;
            border: 2px solid #e5e7eb;
        }
        .import-step-dot.active {
            background: #eff6ff;
            color: #2563eb;
            border: 2px solid #3b82f6;
            animation: pulse 1.2s ease infinite;
        }
        @keyframes pulse {
            0%,100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.3); }
            50%      { box-shadow: 0 0 0 6px rgba(59,130,246,0); }
        }
        .import-step-dot.done {
            background: #2c5f2d;
            color: white;
            border: 2px solid #2c5f2d;
        }
        .import-step-label {
            font-size: 12px;
            color: #6b7280;
            font-weight: 500;
            flex: 1;
        }
        .import-step-label.active { color: #2563eb; font-weight: 600; }
        .import-step-label.done   { color: #166534; }
        .import-step-connector {
            width: 32px;
            height: 2px;
            background: #e5e7eb;
            flex-shrink: 0;
            transition: background 0.3s;
            margin: 0 4px;
        }
        .import-step-connector.done { background: #2c5f2d; }

        /* 任务列表 */
        .import-task-area {
            background: #f8fafc;
            border: 1px solid #e2e8f0;
            border-radius: 12px;
            padding: 12px;
            max-height: 260px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }
        .import-task-area::-webkit-scrollbar { width: 4px; }
        .import-task-area::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

        .import-task-row {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 7px 10px;
            border-radius: 8px;
            font-size: 13px;
            transition: background 0.2s;
        }
        .import-task-row.task-pending { background: transparent; color: #9ca3af; }
        .import-task-row.task-running { background: #eff6ff; color: #1d4ed8; }
        .import-task-row.task-done    { background: #f0fdf4; color: #166534; }
        .import-task-row.task-error   { background: #fff1f2; color: #be123c; }

        .import-task-icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }
        .import-task-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .import-task-badge {
            font-size: 11px;
            padding: 2px 8px;
            border-radius: 20px;
            font-weight: 600;
            flex-shrink: 0;
        }
        .task-pending .import-task-badge { background: #f3f4f6; color: #9ca3af; }
        .task-running .import-task-badge { background: #dbeafe; color: #1d4ed8; }
        .task-done    .import-task-badge { background: #dcfce7; color: #166534; }
        .task-error   .import-task-badge { background: #fee2e2; color: #dc2626; }

        /* 底部统计 */
        .import-modal-footer {
            margin-top: 20px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 12px;
            color: #9ca3af;
        }
        .import-progress-bar-wrap {
            margin-top: 16px;
            height: 4px;
            background: #e5e7eb;
            border-radius: 2px;
            overflow: hidden;
        }
        .import-progress-bar {
            height: 100%;
            background: linear-gradient(90deg, #2c5f2d, #4ade80);
            border-radius: 2px;
            transition: width 0.4s ease;
        }

        /* ===== 顶部固定工具栏 ===== */
        .top-fixed-toolbar {
            position: sticky;
            top: 0;
            z-index: 1001;
            background: white;
            border-radius: 0 0 16px 16px;
            padding: 10px 20px;
            margin-bottom: 16px;
            box-shadow: 0 4px 16px rgba(0,0,0,0.1);
            display: flex;
            gap: 12px;
            align-items: center;
            flex-wrap: wrap;
        }
        .toolbar-dropdown-wrap {
            position: relative;
        }
        .toolbar-dropdown-btn {
            background: #f0f9ff;
            border: 1px solid #bae6fd;
            color: #0369a1;
            padding: 7px 16px;
            border-radius: 20px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 5px;
            transition: 0.15s;
            white-space: nowrap;
        }
        .toolbar-dropdown-btn:hover { background: #e0f2fe; }
        .toolbar-dropdown-btn.active { background: #0369a1; color: white; border-color: #0369a1; }
        .toolbar-dropdown-panel {
            position: absolute;
            top: calc(100% + 8px);
            left: 0;
            width: 320px;
            max-height: 75vh;
            overflow-y: auto;
            background: white;
            border: 1px solid #e5e7eb;
            border-radius: 14px;
            box-shadow: 0 12px 40px rgba(0,0,0,0.18);
            padding: 16px;
            z-index: 2000;
            display: none;
            font-size: 13px;
        }
        .toolbar-dropdown-panel.open { display: block; }
        .toolbar-dropdown-panel::-webkit-scrollbar { width: 4px; }
        .toolbar-dropdown-panel::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

        /* ===== Spinner数字控件（框内上下箭头） ===== */
        .spinner-control {
            display: flex;
            align-items: stretch;
            border: 1px solid #d1d5db;
            border-radius: 5px;
            overflow: hidden;
            height: 24px;
        }
        .spinner-input {
            width: 34px;
            text-align: center;
            border: none;
            outline: none;
            font-size: 11px;
            background: #fff;
            color: #374151;
            padding: 0;
        }
        .spinner-arrows {
            display: flex;
            flex-direction: column;
            border-left: 1px solid #d1d5db;
        }
        .spinner-up, .spinner-down {
            flex: 1;
            border: none;
            background: #f9fafb;
            cursor: pointer;
            font-size: 6px;
            padding: 0 3px;
            line-height: 1;
            color: #6b7280;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .spinner-up:hover, .spinner-down:hover {
            background: #e5e7eb;
            color: #111827;
        }
        .spinner-up {
            border-bottom: 1px solid #d1d5db;
        }

/* ── 字体与排版区块专用布局 ── */
.typo-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.typo-two-col {
    display: flex;
    align-items: center;
    gap: 8px;
}
.typo-two-col .typo-inline-item {
    flex: 1;
}
.typo-inline-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.typo-label {
    font-size: 12px;
    color: #374151;
    white-space: nowrap;
    width: 28px;
    flex-shrink: 0;
}
.typo-style-group {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}
.typo-divider {
    display: flex;
    align-items: center;
    font-size: 10px;
    color: #9ca3af;
    margin: 4px 0 6px 0;
    gap: 6px;
    letter-spacing: 0.3px;
}
.typo-divider::before,
.typo-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

        /* ===== 紧凑行：多控件横排 ===== */
        .compact-row {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-bottom: 8px;
            flex-wrap: nowrap;
        }
        .compact-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2px;
            flex: 1;
            min-width: 0;
        }
        .compact-label {
            font-size: 10px;
            color: #9ca3af;
            white-space: nowrap;
        }

          /* ===== 统一增加标签与控件的间距 ===== */
          .typo-inline-item {
            display: flex;
            align-items: center;
            gap: 12px;   /* 加大标签与调节框之间的距离 */
          }

          /* 边框样式行：增加标签与按钮组之间的距离 */
          .typo-row .sidebar-align-group {
            margin-left: 12px;
          }

          /* 确保边框样式按钮的高度与 spinner 控件匹配 */
          .sidebar-style-btn {
            height: 26px;
            line-height: 1;
            padding: 0 10px;
          }

          /* 右侧边栏改为弹性列布局，使底部区域始终在最下 */
          #styleSidebar {
              display: flex !important;
              flex-direction: column;
              overflow-y: auto;
              padding: 0 !important;  /* 原有padding可能影响，去掉由内部元素控制 */
          }
          #styleSidebar > #sidebarContent {
              flex: 1;
              overflow-y: auto;
              padding: 20px;
          }
          #styleSidebar > .sidebar-footer {
              flex-shrink: 0;
              background: #f9fafb;
              border-top: 1px solid #e5e7eb;
              padding: 12px 20px;
          }

/* ===== 顶部工具栏紧凑美观样式 ===== */
.top-fixed-toolbar {
    padding: 8px 16px !important;
    gap: 10px !important;
    background: #f8fafc !important;
    border-radius: 24px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
}

/* 所有按钮统一样式 */
.top-fixed-toolbar button {
    padding: 5px 12px !important;
    font-size: 13px !important;
    border-radius: 20px !important;
    border: 1px solid #e2e8f0 !important;
    background: white !important;
    color: #334155 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    height: auto !important;
}

/* 按钮悬停效果 */
.top-fixed-toolbar button:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px);
}

/* 主要按钮（如导入等）保留原有绿色风格，但缩小尺寸 */
.top-fixed-toolbar .btn-primary {
    background: #2c5f2d !important;
    color: white !important;
    border-color: #2c5f2d !important;
}
.top-fixed-toolbar .btn-primary:hover {
    background: #1f4520 !important;
}

/* 撤销重做按钮单独微调 */
.undo-redo-bar button {
    padding: 5px 12px !important;
    font-size: 13px !important;
}

/* 排版模式容器样式调整 */
.top-fixed-toolbar > div[style*="display:inline-flex"] {
    padding: 3px 8px !important;
    background: #f1f5f9 !important;
    border-radius: 28px !important;
}
.top-fixed-toolbar > div[style*="display:inline-flex"] span {
    font-size: 12px !important;
}
.top-fixed-toolbar > div[style*="display:inline-flex"] button {
    padding: 3px 12px !important;
    font-size: 12px !important;
    background: white !important;
}

/* 下拉按钮特殊处理 */
.toolbar-dropdown-btn {
    background: white !important;
    border: 1px solid #e2e8f0 !important;
    padding: 5px 12px !important;
    font-size: 13px !important;
}
.toolbar-dropdown-btn:hover {
    background: #f1f5f9 !important;
}

/* 下拉面板内按钮样式 */
.toolbar-dropdown-panel button {
    padding: 6px 12px !important;
    font-size: 13px !important;
    justify-content: center !important;
    background: #f8fafc !important;
}
.toolbar-dropdown-panel button:hover {
    background: #e2e8f0 !important;
}

/* 排版模式按钮高亮专用样式（高优先级） */
.top-fixed-toolbar button.mode-btn-active {
    padding: 5px 14px !important;
    border-radius: 24px !important;
    border: none !important;
    background: #1e40af !important;
    color: white !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2) !important;
    transition: all 0.2s !important;
}
.top-fixed-toolbar button.mode-btn-inactive {
    padding: 5px 14px !important;
    border-radius: 24px !important;
    border: 1px solid #cbd5e1 !important;
    background: #f8fafc !important;
    color: #475569 !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
}
.mode-btn-inactive:hover {
    background: #e2e8f0 !important;
    border-color: #94a3b8 !important;
}

        /* ===== 样式模板管理 ===== */
        .tpl-item {
            background: linear-gradient(135deg, #ffffff, #f8fafc);
            border: 1px solid #e2e8f0;
            border-radius: 14px;
            padding: 16px 18px;
            margin-bottom: 10px;
            transition: all 0.2s ease;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }
        .tpl-item::before {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0;
            height: 3px;
            background: linear-gradient(90deg, #3b82f6, #8b5cf6, #06b6d4);
            opacity: 0;
            transition: opacity 0.2s;
        }
        .tpl-item:hover {
            border-color: #93c5fd;
            box-shadow: 0 4px 16px rgba(59,130,246,0.1);
            transform: translateY(-1px);
        }
        .tpl-item:hover::before {
            opacity: 1;
        }
        .tpl-item-header {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            margin-bottom: 8px;
        }
        .tpl-item-title {
            font-size: 15px;
            font-weight: 700;
            color: #0f172a;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            flex: 1;
            min-width: 0;
        }
        .tpl-item-badge {
            font-size: 10px;
            padding: 2px 8px;
            border-radius: 20px;
            background: #f0f9ff;
            color: #0369a1;
            border: 1px solid #bae6fd;
            white-space: nowrap;
            flex-shrink: 0;
            margin-left: 8px;
        }
        .tpl-item-meta {
            font-size: 11px;
            color: #94a3b8;
            margin-bottom: 10px;
            line-height: 1.5;
        }
        .tpl-item-tags {
            display: flex;
            gap: 4px;
            flex-wrap: wrap;
            margin-bottom: 10px;
        }
        .tpl-tag {
            font-size: 10px;
            padding: 2px 7px;
            border-radius: 4px;
            background: #f1f5f9;
            color: #64748b;
            border: 1px solid #e2e8f0;
        }
        .tpl-item-actions {
            display: flex;
            gap: 6px;
        }
        .tpl-item-actions button {
            padding: 6px 0;
            border-radius: 8px;
            border: 1px solid #e2e8f0;
            font-size: 12px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.15s;
            background: white;
            color: #475569;
        }
        .tpl-item-actions button:hover {
            background: #f1f5f9;
        }
        .tpl-item-actions .tpl-preview {
            flex: 1;
            background: #f8fafc;
            color: #475569;
        }
        .tpl-item-actions .tpl-preview:hover {
            background: #e0f2fe;
            border-color: #7dd3fc;
            color: #0369a1;
        }
        .tpl-item-actions .tpl-apply {
            flex: 1;
            background: linear-gradient(135deg, #2c5f2d, #3a7d3b);
            color: white;
            border-color: #2c5f2d;
            font-weight: 600;
        }
        .tpl-item-actions .tpl-apply:hover {
            background: linear-gradient(135deg, #1f4520, #2c5f2d);
            box-shadow: 0 2px 8px rgba(44,95,45,0.3);
        }
        .tpl-item-actions .tpl-del {
            flex: 0 0 36px;
            color: #cbd5e1;
            font-size: 14px;
        }
        .tpl-item-actions .tpl-del:hover {
            background: #fff1f2;
            border-color: #fca5a5;
            color: #dc2626;
        }
        .tpl-empty {
            text-align: center;
            padding: 40px 20px;
            color: #94a3b8;
        }
        .tpl-empty-icon {
            font-size: 48px;
            margin-bottom: 12px;
            opacity: 0.5;
        }
        .tpl-empty-text {
            font-size: 14px;
            margin-bottom: 4px;
            color: #64748b;
        }
        .tpl-empty-hint {
            font-size: 12px;
            color: #94a3b8;
        }
    /* AI校对按钮加载动画 */
    @keyframes proofSpin {
        0% { transform: rotate(0deg); }
        50% { transform: rotate(180deg); }
        100% { transform: rotate(360deg); }
    }
    .fab-btn.proofing {
        animation: proofSpin 1s ease-in-out infinite;
    }

        /* ==================== 图片节点样式 ==================== */
        .image-node {
            position: relative;
            display: inline-block;
            max-width: 100%;
        }
        .image-node img {
            display: block;
            max-width: 100%;
            height: auto;
            transition: opacity 0.2s;
        }
        .image-node.clip-rect img { clip-path: none; border-radius: 0; }
        .image-node.clip-rounded img { border-radius: 12px; }
        .image-node.clip-circle img { border-radius: 50%; }
        .image-node.clip-ellipse img { border-radius: 50%; }

        /* 图片四角缩放手柄 */
        .image-corner-handle {
            position: absolute;
            width: 12px;
            height: 12px;
            background: #3b82f6;
            border: 2px solid white;
            border-radius: 2px;
            z-index: 20;
            opacity: 0;
            transition: opacity 0.15s;
            box-shadow: 0 1px 4px rgba(0,0,0,0.3);
            pointer-events: auto !important;
        }
        .image-corner-handle.corner-nw { top: -6px; left: -6px; cursor: nw-resize; }
        .image-corner-handle.corner-ne { top: -6px; right: -6px; cursor: ne-resize; }
        .image-corner-handle.corner-sw { bottom: -6px; left: -6px; cursor: sw-resize; }
        .image-corner-handle.corner-se { bottom: -6px; right: -6px; cursor: se-resize; }

        [data-node-id]:hover .image-corner-handle,
        [data-node-id].node-selected .image-corner-handle {
            opacity: 1;
        }

        /* 图片旋转手柄 */
        .image-rotate-handle {
            position: absolute;
            top: -30px;
            left: 50%;
            transform: translateX(-50%);
            width: 20px;
            height: 20px;
            background: #3b82f6;
            border: 2px solid white;
            border-radius: 50%;
            cursor: grab;
            z-index: 20;
            opacity: 0;
            transition: opacity 0.15s;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 10px;
            color: white;
            box-shadow: 0 1px 4px rgba(0,0,0,0.3);
            pointer-events: auto !important;
        }
        .image-rotate-handle::after {
            content: '';
            position: absolute;
            bottom: -10px;
            left: 50%;
            transform: translateX(-50%);
            width: 1px;
            height: 10px;
            background: #3b82f6;
        }
        [data-node-id]:hover .image-rotate-handle,
        [data-node-id].node-selected .image-rotate-handle {
            opacity: 1;
        }

        /* 文字环绕模式 */
        .wrap-inline { display: inline-block; vertical-align: middle; }
        .wrap-left { float: left; margin-right: 12px; margin-bottom: 8px; }
        .wrap-right { float: right; margin-left: 12px; margin-bottom: 8px; }
        .wrap-top-bottom { display: block; margin: 8px auto; clear: both; }
        .wrap-behind { position: relative; z-index: 1; pointer-events: none; }
        .wrap-behind img { pointer-events: none; }
        .wrap-front { position: relative; z-index: 100; pointer-events: none; }
        /* 图片面板专用 */
        .image-panel-section {
            background: #f8fafc;
            border: 1px solid #e2e8f0;
            border-radius: 10px;
            padding: 12px;
            margin-bottom: 12px;
        }
        .image-panel-title {
            font-size: 12px;
            font-weight: 600;
            color: #6b7280;
            margin-bottom: 12px;
            letter-spacing: 0.5px;
        }
        .image-slider-row {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 8px;
        }
        .image-slider-row label {
            font-size: 12px;
            color: #4b5563;
            width: 50px;
            flex-shrink: 0;
        }
        .image-slider-row input[type="range"] {
            flex: 1;
            height: 4px;
            -webkit-appearance: none;
            appearance: none;
            background: #e2e8f0;
            border-radius: 2px;
            outline: none;
        }
        .image-slider-row input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 14px;
            height: 14px;
            background: #3b82f6;
            border-radius: 50%;
            cursor: pointer;
        }
        .image-slider-row .slider-value {
            font-size: 12px;
            color: #374151;
            width: 36px;
            text-align: right;
            flex-shrink: 0;
        }
        .wrap-mode-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 4px;
        }
        .wrap-mode-btn {
            padding: 6px 4px;
            border: 1px solid #e2e8f0;
            background: #fff;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            text-align: center;
            transition: 0.15s;
            color: #475569;
        }
        .wrap-mode-btn.active {
            background: #3b82f6;
            color: white;
            border-color: #3b82f6;
        }
        .wrap-mode-btn:hover:not(.active) {
            background: #f1f5f9;
        }
        .clip-shape-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 4px;
        }
        .clip-shape-btn {
            padding: 6px 4px;
            border: 1px solid #e2e8f0;
            background: #fff;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            text-align: center;
            transition: 0.15s;
            color: #475569;
        }
        .clip-shape-btn.active {
            background: #3b82f6;
            color: white;
            border-color: #3b82f6;
        }
        .clip-shape-btn:hover:not(.active) {
            background: #f1f5f9;
        }
        .image-size-inputs {
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .image-size-inputs input {
            width: 60px;
            padding: 5px 6px;
            border: 1px solid #d1d5db;
            border-radius: 6px;
            font-size: 12px;
            text-align: center;
        }
        .image-lock-ratio {
            width: 24px;
            height: 24px;
            border: 1px solid #d1d5db;
            background: #f9fafb;
            border-radius: 6px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            flex-shrink: 0;
        }
        .image-lock-ratio.locked {
            background: #dbeafe;
            border-color: #93c5fd;
            color: #2563eb;
        }

        /* 保存状态指示器 */
        #saveStatusIndicator {
            font-family: system-ui, 'Segoe UI', 'Noto Sans CJK SC', '微软雅黑', sans-serif;
            transition: color 0.3s;
            flex-shrink: 0;
        }

        /* 历史记录项 */
        .history-item {
            background: #f8fafc;
            border: 1px solid #e2e8f0;
            border-radius: 12px;
            padding: 14px 16px;
            margin-bottom: 10px;
            transition: 0.15s;
        }
        .history-item:hover {
            background: #f0f9ff;
            border-color: #bae6fd;
        }
        .history-item-header {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-bottom: 6px;
        }
        .history-item-title {
            font-size: 14px;
            font-weight: 700;
            color: #1f2937;
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .history-item-badge {
            font-size: 11px;
            background: #e0f2fe;
            color: #0369a1;
            padding: 2px 8px;
            border-radius: 12px;
            font-weight: 600;
            flex-shrink: 0;
        }
        .history-item-meta {
            font-size: 11px;
            color: #9ca3af;
            margin-bottom: 8px;
        }
        .history-item-actions {
            display: flex;
            gap: 6px;
        }
        .history-item-actions button {
            padding: 4px 14px;
            border-radius: 16px;
            border: 1px solid #d1d5db;
            background: white;
            cursor: pointer;
            font-size: 12px;
            transition: 0.15s;
            color: #374151;
        }
        .history-restore {
            color: #2c5f2d !important;
            border-color: #2c5f2d !important;
            font-weight: 600;
        }
        .history-restore:hover {
            background: #2c5f2d !important;
            color: white !important;
        }
        .history-del {
            color: #9ca3af !important;
            width: 32px;
            padding: 4px 0 !important;
            text-align: center;
        }
        .history-del:hover {
            color: #dc2626 !important;
            border-color: #dc2626 !important;
            background: #fef2f2 !important;
        }

        /* 模板重命名按钮 */
        .tpl-rename-btn {
            color: #6366f1 !important;
            background: #eef2ff !important;
            border-color: #c7d2fe !important;
            width: 32px;
            padding: 4px 0 !important;
            text-align: center;
        }
        .tpl-rename-btn:hover {
            background: #6366f1 !important;
            color: white !important;
        }

/* ── 配对分组节点样式 ── */
.group-node {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin: 4px 0;
    padding: 4px 0;
    page-break-inside: avoid;
    break-inside: avoid;
}

.group-brace {
    font-family: 'Noto Serif CJK SC', 'SimSun', '宋体', serif;
    font-weight: 300;
    color: #1e40af;
    flex-shrink: 0;
    user-select: none;
    pointer-events: none;
    line-height: 1;
}

/* ── 大括号前缀 hover 效果 ── */
.group-prefix[data-empty]:hover {
    background: rgba(59,130,246,0.1) !important;
}
/* 即时 tooltip（替代原生 title 延迟） */
.group-prefix[data-empty]::after {
    content: attr(title);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: -26px;
    white-space: nowrap;
    background: rgba(0,0,0,0.78);
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.1s;
    line-height: 1.3;
}
.group-prefix[data-empty]:hover::after {
    opacity: 1;
    transition: opacity 0s;
}

.group-items {
    display: flex;
    gap: 4px 12px;
}

.group-items .group-item {
    white-space: nowrap;
    display: flex;
    align-items: center;
}

/* ── 竖排布局下的特殊样式 ── */
.group-node[data-node-type="group"] .group-items[style*="column"] {
    /* flex-direction: column 由JS内联设置 */
}

/* ── 渲染期间禁用所有过渡动画，减少重建时开销 ── */
.no-transition,
.no-transition *,
.no-transition *::before,
.no-transition *::after {
    transition: none !important;
    animation: none !important;
}

/* ===== 画框 Frame ===== */
.frame-node {
    position: relative;
    overflow: hidden;
}

/* Frame selected state */
[data-node-id].node-selected.frame-node {
    outline: 2px solid #3b82f6;
    outline-offset: -1px;
}

/* Frame preset buttons */
.frame-preset-btn {
    padding: 5px 12px;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.frame-preset-btn:hover {
    background: #dcfce7;
    border-color: #86efac;
}
.frame-preset-btn:active {
    transform: scale(0.96);
}

/* Print: ensure frame colors render */
@media print {
    .frame-node {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ===== KaTeX 字体跟随正文：不使用 KaTeX 自带字体 ===== */
/* ===== KaTeX 字体跟随正文，字号仅外层对齐 ===== */
.math-inline,
.math-display,
.katex {
    font-family: inherit !important;
    font-size: 1em !important;
}
/* 仅文字内容类替换为正文字体，保留结构性元素（accent、vlist等）的KaTeX原生字体 */
.katex .mord,
.katex .mathnormal,
.katex .mathrm,
.katex .mathit,
.katex .mathbf,
.katex .mathsf,
.katex .mathtt,
.katex .text,
.katex .mbox {
    font-family: inherit;
}

.col-calc,
.col-calc *,
.col-calc-div,
.col-calc-div * {
    font-family: inherit !important;
}

/* 上标/下标：缩小到正文的75%，不跟正文一样大 */
/* 分数分子分母：保持1em不变，不受上标缩小影响 */
.katex .mtight {
    font-size: 0.75em !important;
    padding: 0.04em 0;
}
.katex .mfrac .mtight {
    font-size: 1em !important;
}

/* 循环小数/重音符号：强制点在数字正上方居中（不依赖KaTeX计算的left偏移） */
.katex .accent .accent-body:not(.accent-full) {
    left: 0 !important;
}
.katex .accent .accent-body:not(.accent-full) > * {
    transform: translate(-50%, -0.35em);
    display: inline-block;
}

/* ===== 比大小圆圈答案 ===== */
.cmp-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4em;
    height: 1.4em;
    border: 1px solid currentColor;
    border-radius: 50%;
    font-size: 0.85em;
    vertical-align: -0.03em;
    margin: 0 2px;
    padding: 0 2px;
    box-sizing: border-box;
    line-height: 1;
}

/* 有答案的圆圈：往上微调，跟周围数字/公式视觉居中 */
.cmp-circle-ans {
    position: relative;
    top: -1px;
}

/* ==================== 图片伪实拍批处理工具 ==================== */

.ws-sidebar-btn-wrap {
    padding: 0 16px 12px;
    flex-shrink: 0;
    margin-top: auto;
}

.ws-overlay-box {
    background: white;
    border-radius: 20px;
    width: 1160px;
    max-width: 98vw;
    height: 92vh;
    max-height: 94vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.05);
    animation: slideUp 0.25s ease;
}

.ws-overlay-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ws-overlay-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ws-overlay-body {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

.ws-left-panel {
    width: 400px;
    flex-shrink: 0;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border-right: 1px solid #e5e7eb;
    background: #fafbfc;
    overflow-y: auto;
}

.ws-right-panel {
    flex: 1;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.ws-section {
    margin-bottom: 4px;
}

.ws-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.ws-field-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.ws-label {
    font-size: 13px;
    color: #374151;
    width: 36px;
    flex-shrink: 0;
    font-weight: 500;
}

.ws-input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    font-size: 12px;
    background: white;
    color: #374151;
    min-width: 0;
    transition: background 0.2s, border-color 0.2s;
}

.ws-btn-browse {
    padding: 7px 12px;
    background: #2c3e50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}
.ws-btn-browse:hover { background: #34495e; }

.ws-btn-start {
    flex: 1;
    padding: 9px 16px;
    background: #2c5f2d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.ws-btn-start:hover { background: #1f4520; }
.ws-btn-start:disabled { background: #9ca3af; cursor: not-allowed; }

.ws-btn-stop {
    flex: 1;
    padding: 9px 16px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.ws-btn-stop:hover { background: #b91c1c; }
.ws-btn-stop:disabled { background: #9ca3af; cursor: not-allowed; }

.ws-progress-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.ws-progress-bar-bg {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.ws-progress-bar-fill {
    height: 100%;
    background: #27ae60;
    border-radius: 4px;
    transition: width 0.3s;
}

.ws-progress-label {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
}

.ws-log-box {
    flex: 1;
    min-height: 120px;
    max-height: 260px;
    overflow-y: auto;
    background: #1e293b;
    border-radius: 6px;
    padding: 8px 10px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.ws-ad-text {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    line-height: 2;
    flex-shrink: 0;
    padding: 6px 0;
    background: #f1f5f9;
    border-radius: 6px;
}

.ws-preview-wrap {
    flex: 1 1 0;
    background: #f1f5f9;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 420px;
    min-width: 0;
    contain: layout style;
}

.ws-preview-wrap canvas {
    display: block;
    cursor: default;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ws-status-bar {
    text-align: center;
    padding: 8px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    margin-top: 8px;
    font-size: 12px;
    color: #64748b;
    font-family: 'Consolas', monospace;
}

/* ==================== 图片去重过原创工具 ==================== */
.qc-effects-scroll {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    padding-right: 4px;
}

.qc-effect-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    margin-bottom: 2px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}
.qc-effect-row:hover { background: #f1f5f9; }

.qc-slider-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 28px;
    margin-bottom: 4px;
    transition: opacity 0.2s, max-height 0.3s;
    overflow: hidden;
}
.qc-slider-hide { opacity: 0.4; pointer-events: none; }

.qc-slider-label {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
}
.qc-slider-val {
    font-size: 11px;
    color: #374151;
    font-weight: 600;
    min-width: 36px;
    text-align: right;
}

.qc-slider-row input[type="range"] {
    flex: 1;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #d1d5db;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}
.qc-slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #7c3aed;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.qc-preview-wrap {
    cursor: default;
    position: relative;
}
.qc-preview-wrap canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 水印颜色色块 */
.qc-color-swatches { display: flex; gap: 3px; align-items: center; }
.qc-swatch {
    display: inline-block;
    width: 16px; height: 16px;
    border-radius: 3px;
    cursor: pointer;
    transition: transform 0.1s;
    box-sizing: border-box;
}
.qc-swatch:hover { transform: scale(1.3); box-shadow: 0 1px 4px rgba(0,0,0,0.3); }

/* 水印字体选择下拉框 */
.wm-font-select {
    padding: 3px 6px;
    border: 1px solid #d0d7de;
    border-radius: 4px;
    font-size: 11px;
    background: white;
    cursor: pointer;
}
.wm-font-select:focus { outline: none; border-color: #2563eb; }

/* 水印面板切换按钮 hover */
#wsWatermarkToggleBtn:hover { background: #f1f5f9; }

/* 水印面板内图片选择按钮 hover */
#wsWmImgSelect:hover { border-color: #2563eb; color: #2563eb; }
