
/* ============================================================================================= */

/* ===== 现代窗口通用样式 (人物设定 & 关系设定) ===== */
.modern-window {
    display: none;
    /* 默认隐藏，由 JS 控制显示 */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: auto;
    min-width: 600px;
    min-height: 300px;
    max-width: 85vw;
    max-height: 80vh;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0, 0, 0, 0.08);
    z-index: 1000000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    transition: box-shadow 0.25s ease, border-radius 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(2px);
}

/* 窗口头部工具栏 */
.modern-window .window-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e9edf2;
    flex-shrink: 0;
    min-height: 52px;
    cursor: move;
    /* 拖动区域 */
}

.modern-window .window-toolbar .toolbar-title {
    font-weight: 600;
    font-size: 16px;
    color: #0f172a;
    margin-right: 16px;
    letter-spacing: 0.3px;
    user-select: none;
}

.modern-window .window-toolbar .btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: auto;
}

.modern-window .window-toolbar button {
    border: none;
    border-radius: 8px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    background: #ffffff;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
    white-space: nowrap;
}

.modern-window .window-toolbar button:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.modern-window .window-toolbar button.primary {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

.modern-window .window-toolbar button.primary:hover {
    background: #4338ca;
    border-color: #4338ca;
}

.modern-window .window-toolbar button.danger {
    color: #dc2626;
    border-color: #fca5a5;
}

.modern-window .window-toolbar button.danger:hover {
    background: #fee2e2;
    border-color: #f87171;
}

.modern-window .window-toolbar button.close-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    padding: 0 8px;
    box-shadow: none;
}

.modern-window .window-toolbar button.close-btn:hover {
    color: #ef4444;
    background: transparent;
    transform: none;
    box-shadow: none;
}

/* 内容区域（表格容器） */
.modern-window .window-body {
    flex: 1;
    overflow: auto;
    padding: 16px 20px 20px 20px;
    background: #ffffff;
}

/* 表格样式 */
.modern-window table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 0 1px #e9edf2;
}

.modern-window table th {
    background: #f1f5f9;
    font-weight: 600;
    color: #0f172a;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    font-size: 13px;
}

.modern-window table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.modern-window table tr:last-child td {
    border-bottom: none;
}

.modern-window table tr:hover {
    background: #fafbff;
}

/* 表格内的输入框、文本域 */
.modern-window table input[type="text"],
.modern-window table textarea {
    width: 100%;
    border: none;
    background: transparent;
    padding: 4px 6px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    border-radius: 4px;
    transition: background 0.15s;
}

.modern-window table input[type="text"]:focus,
.modern-window table textarea:focus {
    background: #f8fafc;
    box-shadow: inset 0 0 0 2px #4f46e5;
}

.modern-window table textarea {
    min-height: 40px;
}

/* 头像列（人物设定） */
.modern-window .avatar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.modern-window .avatar-wrapper .avatar-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
}

.modern-window .avatar-wrapper .avatar-img:hover {
    border-color: #4f46e5;
    transform: scale(1.02);
}

.modern-window .avatar-wrapper .name-row {
    width: 100%;
}

.modern-window .avatar-wrapper input.char-name {
    text-align: center;
    font-weight: 500;
    background: transparent;
    border: none;
    width: 100%;
    padding: 2px;
}

/* 复选框美化 */
.modern-window table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #4f46e5;
}

/* 关系设定表格特殊列宽 */
.modern-window .rel-select-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.modern-window .rel-select-wrapper img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e2e8f0;
}

.modern-window .rel-select-wrapper select {
    flex: 1;
    border: none;
    background: transparent;
    padding: 4px 2px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    font-family: inherit;
}

.modern-window .rel-select-wrapper select:focus {
    background: #f8fafc;
}

/* 滚动条美化 */
.modern-window .window-body::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.modern-window .window-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.modern-window .window-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.modern-window .window-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .modern-window {
        min-width: 90vw;
        min-height: 40vh;
        max-height: 85vh;
        border-radius: 16px;
    }

    .modern-window .window-toolbar {
        padding: 8px 14px;
        gap: 4px;
    }

    .modern-window .window-toolbar button {
        font-size: 12px;
        padding: 4px 10px;
    }

    .modern-window .window-body {
        padding: 12px 12px 16px;
    }
}

/* 现代窗口样式（仅类，不干扰原有布局） */
.modern-window {
    display: none;
    /* 默认隐藏，由 JS 控制显示 */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    z-index: 1000000;
    max-width: 85vw;
    max-height: 80vh;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.modern-window .window-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e9edf2;
    cursor: move;
    flex-shrink: 0;
}

.modern-window .window-body {
    flex: 1;
    overflow: auto;
    padding: 16px 20px;
    background: #ffffff;
}

/* 人物设定窗口头像 - 固定为圆形 */
.modern-window .avatar-wrapper .avatar-img {
    width: 140px !important;
    height: 140px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
    flex-shrink: 0;
}

/* 同时确保头像容器居中 */
.modern-window .avatar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}














/* ============================================================================================= */
/* ============================================
★★★ 剧情卡编辑器 - 简洁上档次版 ★★★
============================================ */

/* ---- 编辑器主容器 ---- */
.story-editor-box {
    background: #f8fafc !important;
}

/* ---- 头部 - 柔和白底 ---- */
.story-editor-header {
    background: #ffffff !important;
    border-bottom: 1px solid #eef2f7 !important;
    padding: 12px 24px !important;
    border-radius: 16px 16px 0 0 !important;
}

.story-editor-header .story-editor-title {
    color: #0f172a !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    letter-spacing: 0.3px;
}

.story-editor-header .story-editor-title::before {
    content: '📖 ';
}

/* 头部按钮组 - 清晰可见 */
.story-toolbar-btn {
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    color: #475569 !important;
    padding: 6px 16px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.story-toolbar-btn:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.story-toolbar-btn.story-save-btn {
    background: #4f46e5 !important;
    border: none !important;
    color: #fff !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.25) !important;
}

.story-toolbar-btn.story-save-btn:hover {
    background: #4338ca !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(79, 70, 229, 0.35) !important;
}

/* ---- 标签栏 ---- */
.story-editor-tabs {
    background: #ffffff !important;
    border-bottom: 1px solid #eef2f7 !important;
    padding: 6px 24px !important;
    box-shadow: none !important;
}

.story-tab-btn {
    padding: 6px 18px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transition: all 0.25s ease !important;
    border: 1px solid transparent !important;
    background: transparent !important;
    color: #64748b !important;
}

.story-tab-btn.active {
    background: #eef2ff !important;
    color: #4f46e5 !important;
    border-color: #e0e7ff !important;
    box-shadow: none !important;
}

.story-tab-btn:not(.active):hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}

.story-side-btn {
    border-radius: 8px !important;
    padding: 4px 16px !important;
    font-size: 13px !important;
    border: 1.5px solid #e2e8f0 !important;
    background: #ffffff !important;
    color: #475569 !important;
    transition: all 0.25s ease !important;
    font-weight: 500 !important;
}

.story-side-btn:hover {
    border-color: #cbd5e1 !important;
    background: #f8fafc !important;
    color: #0f172a !important;
}

.story-side-btn[style*="background:#4f46e5"] {
    background: #4f46e5 !important;
    border-color: #4f46e5 !important;
    color: #fff !important;
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.25) !important;
}

/* ---- 内容区 ---- */
.story-editor-content {
    background: #f8fafc !important;
    padding: 16px 20px 16px 16px !important;
    gap: 16px !important;
}

/* ---- 主编辑器 ---- */
.story-editor-main {
    border: 1px solid #eef2f7 !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    background: #ffffff !important;
}

.story-editor-main>div:first-child {
    background: #fafbfc !important;
    border-bottom: 1px solid #eef2f7 !important;
    padding: 6px 16px !important;
    font-size: 13px !important;
    color: #94a3b8 !important;
}

.preview-toggle-btn {
    color: #4f46e5 !important;
    font-weight: 600 !important;
    padding: 2px 12px !important;
    border-radius: 6px !important;
    transition: all 0.2s !important;
    background: transparent !important;
    border: none !important;
}

.preview-toggle-btn:hover {
    background: #eef2ff !important;
}

/* ---- 副编辑器 ---- */
.story-editor-side {
    border: 1px solid #eef2f7 !important;
    border-radius: 12px !important;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.03) !important;
    background: #ffffff !important;
}

.story-editor-side>div:first-child {
    background: #fafbfc !important;
    border-bottom: 1px solid #eef2f7 !important;
    padding: 6px 16px !important;
    font-size: 13px !important;
    color: #94a3b8 !important;
}

/* ---- 表单行样式 ---- */
#story-editor-main-content .story-row,
#story-editor-side-content .story-row {
    margin-bottom: 4px !important;
    padding: 4px 8px !important;
    border-radius: 6px !important;
    transition: background 0.15s !important;
}

#story-editor-main-content .story-row:hover,
#story-editor-side-content .story-row:hover {
    background: #fafbfc !important;
}

/* 标签统一风格 */
#story-editor-main-content .story-row>label,
#story-editor-side-content .story-row>label {
    font-weight: 600 !important;
    color: #334155 !important;
    font-size: 13px !important;
    width: 80px !important;
    flex-shrink: 0 !important;
}

/* ---- 标题输入框 ---- */
#story-editor-main-content input[type="text"]:not(.char-info-input),
#story-editor-side-content input[type="text"]:not(.char-info-input) {
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 8px 14px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #0f172a !important;
    background: #fafbfc !important;
    transition: all 0.25s ease !important;
}

#story-editor-main-content input[type="text"]:not(.char-info-input):focus,
#story-editor-side-content input[type="text"]:not(.char-info-input):focus {
    border-color: #4f46e5 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08) !important;
    outline: none !important;
}

/* ---- 可点击卡片（目标/场景） ---- */
#story-editor-main-content .story-row>span[style*="cursor:pointer"],
#story-editor-side-content .story-row>span[style*="cursor:pointer"] {
    background: #f1f4ff !important;
    border-radius: 8px !important;
    padding: 6px 16px !important;
    font-weight: 500 !important;
    color: #4f46e5 !important;
    transition: all 0.2s ease !important;
    border: 1px solid #e4e7ff !important;
    cursor: pointer !important;
}

#story-editor-main-content .story-row>span[style*="cursor:pointer"]:hover,
#story-editor-side-content .story-row>span[style*="cursor:pointer"]:hover {
    background: #e4e7ff !important;
    border-color: #818cf8 !important;
    transform: translateX(3px);
}

/* ---- 人物选择行 ---- */
.char-row {
    background: #fafbfc !important;
    border-radius: 8px !important;
    padding: 4px 10px !important;
    margin-bottom: 4px !important;
    border: 1px solid #f1f5f9 !important;
    transition: all 0.2s !important;
}

.char-row:hover {
    border-color: #e2e8f0 !important;
    background: #ffffff !important;
}

.char-row label {
    font-weight: 600 !important;
    color: #334155 !important;
    font-size: 13px !important;
    width: 76px !important;
    flex-shrink: 0 !important;
}

.char-row select {
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 4px 8px !important;
    font-size: 13px !important;
    background: #ffffff !important;
    color: #0f172a !important;
    transition: all 0.25s ease !important;
    cursor: pointer !important;
    flex: 0 0 120px !important;
    max-width: 130px !important;
    height: 34px !important;
}

.char-row select:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08) !important;
    outline: none !important;
}

.char-row .char-info-input {
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 4px 12px !important;
    font-size: 13px !important;
    color: #0f172a !important;
    background: #ffffff !important;
    transition: all 0.25s ease !important;
    flex: 1 !important;
    min-width: 60px !important;
    height: 34px !important;
}

.char-row .char-info-input:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.06) !important;
    outline: none !important;
}

.char-row .char-info-input::placeholder {
    color: #94a3b8 !important;
    font-size: 12px !important;
}

.char-row img {
    width: 30px !important;
    height: 30px !important;
    border-radius: 50% !important;
    border: 2px solid #e2e8f0 !important;
    flex-shrink: 0 !important;
    object-fit: cover !important;
    background: #f1f5f9 !important;
}

/* ---- 步骤文本域 ---- */
#story-editor-main-content .story-row textarea,
#story-editor-side-content .story-row textarea {
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    font-family: inherit !important;
    color: #0f172a !important;
    background: #fafbfc !important;
    transition: all 0.25s ease !important;
    resize: vertical !important;
    min-height: 44px !important;
    line-height: 1.6 !important;
}

#story-editor-main-content .story-row textarea:focus,
#story-editor-side-content .story-row textarea:focus {
    border-color: #4f46e5 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.05) !important;
    outline: none !important;
}

#story-editor-main-content .story-row textarea::placeholder,
#story-editor-side-content .story-row textarea::placeholder {
    color: #94a3b8 !important;
}

/* 步骤标签特殊样式 */
#story-editor-main-content .story-row label[style*="width:100px"],
#story-editor-side-content .story-row label[style*="width:100px"] {
    width: 90px !important;
    font-weight: 600 !important;
    color: #475569 !important;
    font-size: 13px !important;
    padding-top: 6px !important;
}

/* ---- 高潮节点图 ---- */
#story-editor-main-content .story-row img[data-field="climax"],
#story-editor-side-content .story-row img[data-field="climax"] {
    border-radius: 10px !important;
    border: 2px solid #e2e8f0 !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    cursor: pointer !important;
}

#story-editor-main-content .story-row img[data-field="climax"]:hover,
#story-editor-side-content .story-row img[data-field="climax"]:hover {
    border-color: #4f46e5 !important;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.12) !important;
    transform: scale(1.02);
}

/* ---- 底部状态栏 ---- */
.story-editor-footer {
    background: #fafbfc !important;
    border-top: 1px solid #eef2f7 !important;
    padding: 6px 24px !important;
    border-radius: 0 0 16px 16px !important;
    color: #94a3b8 !important;
    font-size: 13px !important;
}

#story-editor-status {
    color: #475569 !important;
    font-weight: 500 !important;
}

#story-editor-char-count {
    color: #94a3b8 !important;
    font-weight: 500 !important;
}

/* ---- 里程碑只读行 ---- */
#story-editor-main-content .story-row>span[style*="background:#f5f5f5"],
#story-editor-side-content .story-row>span[style*="background:#f5f5f5"] {
    background: #f1f5f9 !important;
    border-radius: 8px !important;
    padding: 6px 16px !important;
    color: #0f172a !important;
    font-weight: 500 !important;
    border: 1px solid #e2e8f0 !important;
}

/* ---- 滚动条美化 ---- */
#story-editor-main-content::-webkit-scrollbar,
#story-editor-side-content::-webkit-scrollbar,
.story-editor-content::-webkit-scrollbar {
    width: 5px !important;
    height: 5px !important;
}

#story-editor-main-content::-webkit-scrollbar-track,
#story-editor-side-content::-webkit-scrollbar-track,
.story-editor-content::-webkit-scrollbar-track {
    background: #f1f5f9 !important;
    border-radius: 8px !important;
}

#story-editor-main-content::-webkit-scrollbar-thumb,
#story-editor-side-content::-webkit-scrollbar-thumb,
.story-editor-content::-webkit-scrollbar-thumb {
    background: #d1d5db !important;
    border-radius: 8px !important;
}

#story-editor-main-content::-webkit-scrollbar-thumb:hover,
#story-editor-side-content::-webkit-scrollbar-thumb:hover,
.story-editor-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8 !important;
}

/* ---- 响应式微调 ---- */
@media (max-width: 900px) {
    .story-editor-side {
        width: 50% !important;
    }

    .char-row label {
        width: 60px !important;
        font-size: 12px !important;
    }

    .char-row select {
        flex: 0 0 90px !important;
        max-width: 100px !important;
        font-size: 12px !important;
    }

    .char-row .char-info-input {
        font-size: 12px !important;
        padding: 4px 8px !important;
    }

    #story-editor-main-content .story-row>label,
    #story-editor-side-content .story-row>label {
        width: 60px !important;
        font-size: 12px !important;
    }

    .story-toolbar-btn {
        font-size: 12px !important;
        padding: 4px 12px !important;
    }
}

@media (max-width: 600px) {
    .story-editor-side {
        width: 100% !important;
        transform: translateX(calc(100% + 10px)) !important;
    }

    .story-editor-header {
        flex-wrap: wrap !important;
        gap: 6px !important;
        padding: 10px 16px !important;
    }

    .story-editor-header .story-editor-title {
        font-size: 16px !important;
    }

    .story-toolbar-btn {
        font-size: 11px !important;
        padding: 4px 10px !important;
    }

    .story-editor-tabs {
        padding: 4px 16px !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
    }

    .story-tab-btn {
        font-size: 12px !important;
        padding: 4px 12px !important;
    }

    .story-editor-content {
        padding: 8px 12px 8px 8px !important;
    }
}

/* 主标签激活态 */
.story-tab-btn.active {
    background: #eef2ff !important;
    color: #4f46e5 !important;
    border-color: #c7d2fe !important;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1) !important;
}

/* 副标签激活态 */
.story-side-btn.active {
    background: #eef2ff !important;
    color: #4f46e5 !important;
    border-color: #c7d2fe !important;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.1) !important;
}


/* 故事设计侧边栏 */
#story-design-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 360px;
    background: #ffffff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    z-index: 10000;
    display: none;
    flex-direction: column;
    border-left: 1px solid #e2e8f0;
}
#story-design-sidebar.open {
    display: flex;
}
.story-design-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    background: #f8fafc;
    margin-bottom: 8px;
    transition: background 0.2s;
}
.story-design-item:hover {
    background: #f1f5f9;
}
.story-design-item .name {
    font-weight: 500;
    color: #0f172a;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 12px;
}
.story-design-item .actions button {
    background: none;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.story-design-item .actions .load-btn {
    background: #eef2ff;
    color: #4f46e5;
}
.story-design-item .actions .load-btn:hover {
    background: #4f46e5;
    color: #fff;
}
.story-design-item .actions .del-btn {
    background: #fef2f2;
    color: #ef4444;
    margin-left: 6px;
}
.story-design-item .actions .del-btn:hover {
    background: #ef4444;
    color: #fff;
}
.story-design-item.active {
    background: #eef2ff;
    border: 1px solid #4f46e5;
}














/* ============================================================================================= */
/* ============================================
       ★★★ 首页样式（主框架内部）- 6卡片版 + AI徽章 ★★★
       ============================================ */

/* ★★★ 首页容器 - 与写作区完全一致的样式 ★★★ */
#home-container {
    flex: 1;
    display: flex;
    height: 100%;
    background: #f8fafc;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* 粒子背景 - 只在首页内部生效 */
#home-container .home-bg-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

#home-container .home-bg-particles span {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(79, 70, 229, 0.08);
    border-radius: 50%;
    animation: homeFloatParticle 25s infinite linear;
}

#home-container .home-bg-particles span:nth-child(1) {
    left: 10%;
    top: 20%;
    animation-duration: 18s;
}
#home-container .home-bg-particles span:nth-child(2) {
    left: 25%;
    top: 60%;
    animation-duration: 22s;
    animation-delay: 2s;
}
#home-container .home-bg-particles span:nth-child(3) {
    left: 40%;
    top: 10%;
    animation-duration: 16s;
    animation-delay: 4s;
}
#home-container .home-bg-particles span:nth-child(4) {
    left: 55%;
    top: 70%;
    animation-duration: 24s;
    animation-delay: 1s;
}
#home-container .home-bg-particles span:nth-child(5) {
    left: 70%;
    top: 30%;
    animation-duration: 20s;
    animation-delay: 3s;
}
#home-container .home-bg-particles span:nth-child(6) {
    left: 85%;
    top: 55%;
    animation-duration: 18s;
    animation-delay: 5s;
}
#home-container .home-bg-particles span:nth-child(7) {
    left: 50%;
    top: 45%;
    animation-duration: 26s;
    animation-delay: 0.5s;
}
#home-container .home-bg-particles span:nth-child(8) {
    left: 5%;
    top: 80%;
    animation-duration: 21s;
    animation-delay: 2.5s;
}
#home-container .home-bg-particles span:nth-child(9) {
    left: 90%;
    top: 10%;
    animation-duration: 19s;
    animation-delay: 3.5s;
}
#home-container .home-bg-particles span:nth-child(10) {
    left: 35%;
    top: 85%;
    animation-duration: 23s;
    animation-delay: 1.5s;
}

@keyframes homeFloatParticle {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    25% {
        transform: translate(30px, -40px) scale(1.5);
        opacity: 0.8;
    }
    50% {
        transform: translate(-20px, 20px) scale(0.8);
        opacity: 0.4;
    }
    75% {
        transform: translate(40px, 30px) scale(1.2);
        opacity: 0.7;
    }
}

/* 首页内容 - 相对定位确保粒子在底层 */
#home-container .home-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 1100px;
    width: 100%;
    padding: 0 8px;
}

/* ===== Logo 区域（含 AI 徽章） ===== */
#home-container .home-logo {
    margin-bottom: 32px;
}

#home-container .home-logo h1 {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    font-size: 36px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: 2px;
    margin: 0;
}

#home-container .home-logo h1 span {
    background: linear-gradient(135deg, #818cf8, #a78bfa);
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
}

#home-container .home-logo-icon {
    font-size: 44px;
    background: linear-gradient(135deg, #818cf8, #a78bfa);
    -webkit-text-fill-color: transparent;
    display: inline-block;
    margin-bottom: 2px;
    animation: homePulse 3s ease-in-out infinite;
}

@keyframes homePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

/* ★★★ AI 快捷入口徽章（标题右侧）★★★ */
#home-container .ai-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 18px 6px 14px;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    border-radius: 50px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(2px);
    white-space: nowrap;
    -webkit-text-fill-color: #fff;  /* 覆盖h1的渐变文字 */
    background-clip: unset;
}

#home-container .ai-quick-btn i {
    font-size: 15px;
    color: #fff;
    filter: drop-shadow(0 0 4px rgba(255,255,255,0.3));
}

#home-container .ai-quick-btn:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 8px 28px rgba(139, 92, 246, 0.45);
    background: linear-gradient(135deg, #f43f5e, #7c3aed);
}

#home-container .ai-quick-btn:active {
    transform: scale(0.95);
}

/* ===== 副标题 ===== */
#home-container .home-subtitle {
    font-size: 15px;
    color: #94a3b8;
    margin-top: 2px;
    letter-spacing: 4px;
    font-weight: 300;
}

/* ============================================
       ★★★ 卡片网格 - 6列平行 ★★★
       ============================================ */
#home-container .home-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
    margin: 0 auto 32px;
}

/* 卡片基础样式 */
#home-container .home-card {
    background: #fff;
    border: 1px solid #eef2f7;
    border-radius: 16px;
    padding: 28px 12px 22px;
    text-align: center;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    color: #0f172a;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

/* 卡片悬浮效果 */
#home-container .home-card:hover {
    transform: translateY(-6px);
    border-color: #c7d2fe;
    box-shadow: 0 12px 40px rgba(79, 70, 229, 0.10);
}

/* ---- 卡片图标 - 六色方案 ---- */
#home-container .home-card-icon {
    font-size: 28px;
    margin-bottom: 10px;
    display: inline-block;
    width: 60px;
    height: 60px;
    line-height: 60px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

/* 蓝色 - 自由创作 */
#home-container .icon-blue {
    background: #eff6ff;
    color: #2563eb;
}
#home-container .home-card:hover .icon-blue {
    background: #2563eb;
    color: #fff;
    transform: scale(1.05);
}

/* 紫色 - 标准创作 */
#home-container .icon-purple {
    background: #eef2ff;
    color: #4f46e5;
}
#home-container .home-card:hover .icon-purple {
    background: #4f46e5;
    color: #fff;
    transform: scale(1.05);
}

/* 绿色 - 仿写小说 */
#home-container .icon-green {
    background: #ecfdf5;
    color: #059669;
}
#home-container .home-card:hover .icon-green {
    background: #059669;
    color: #fff;
    transform: scale(1.05);
}

/* 橙色 - 分析小说 */
#home-container .icon-orange {
    background: #fffbeb;
    color: #d97706;
}
#home-container .home-card:hover .icon-orange {
    background: #d97706;
    color: #fff;
    transform: scale(1.05);
}

/* 红色 - 下载小说 */
#home-container .icon-red {
    background: #fef2f2;
    color: #dc2626;
}
#home-container .home-card:hover .icon-red {
    background: #dc2626;
    color: #fff;
    transform: scale(1.05);
}

/* 靛蓝 - 润笔调色（第6张） */
#home-container .icon-indigo {
    background: #e0e7ff;
    color: #4f46e5;
}
#home-container .home-card:hover .icon-indigo {
    background: #4f46e5;
    color: #fff;
    transform: scale(1.05);
}

/* ---- 卡片标题 ---- */
#home-container .home-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

/* ---- 卡片描述 ---- */
#home-container .home-card-desc {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.5;
}

/* ---- 卡片标签 ---- */
#home-container .home-card-tag {
    display: inline-block;
    margin-top: 8px;
    padding: 3px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

#home-container .tag-blue {
    background: #dbeafe;
    color: #2563eb;
}
#home-container .tag-purple {
    background: #eef2ff;
    color: #4f46e5;
}
#home-container .tag-green {
    background: #ecfdf5;
    color: #059669;
}
#home-container .tag-orange {
    background: #fffbeb;
    color: #d97706;
}
#home-container .tag-red {
    background: #fef2f2;
    color: #dc2626;
}
#home-container .tag-indigo {
    background: #e0e7ff;
    color: #4f46e5;
}

/* ---- 卡片底部装饰线（悬浮时出现） ---- */
#home-container .home-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
    transition: width 0.35s ease;
}

#home-container .home-card:nth-child(1)::after { background: #2563eb; }
#home-container .home-card:nth-child(2)::after { background: #4f46e5; }
#home-container .home-card:nth-child(3)::after { background: #059669; }
#home-container .home-card:nth-child(4)::after { background: #d97706; }
#home-container .home-card:nth-child(5)::after { background: #dc2626; }
#home-container .home-card:nth-child(6)::after { background: #4f46e5; }

#home-container .home-card:hover::after {
    width: 60%;
}

/* ---- 底部信息 ---- */
#home-container .home-footer {
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    border-top: 1px solid #eef2f7;
    padding-top: 18px;
}

#home-container .home-footer-links {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-bottom: 2px;
    flex-wrap: wrap;
}

#home-container .home-footer-links a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

#home-container .home-footer-links a:hover {
    color: #4f46e5;
}

#home-container .home-version {
    font-size: 12px;
    color: #cbd5e1;
}

/* ============================================
       ★★★ 响应式适配 ★★★
       ============================================ */

/* 大屏下保持6列 */
@media (max-width: 1024px) {
    #home-container .home-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 14px;
    }
    #home-container .home-card {
        padding: 24px 10px 18px;
    }
    #home-container .home-card-icon {
        width: 52px;
        height: 52px;
        line-height: 52px;
        font-size: 24px;
    }
    #home-container .home-card-title {
        font-size: 15px;
    }
}

/* 平板：降为3列 */
@media (max-width: 900px) {
    #home-container .home-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    #home-container .home-card {
        padding: 22px 12px 18px;
    }
    #home-container .home-card-icon {
        width: 50px;
        height: 50px;
        line-height: 50px;
        font-size: 22px;
    }
    #home-container .home-card-title {
        font-size: 15px;
    }
    #home-container .home-content h1 {
        font-size: 30px;
    }
}

/* 手机横屏/小屏：2列 */
@media (max-width: 600px) {
    #home-container .home-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    #home-container .home-card {
        padding: 18px 10px 14px;
        border-radius: 12px;
    }
    #home-container .home-card-icon {
        width: 44px;
        height: 44px;
        line-height: 44px;
        font-size: 18px;
    }
    #home-container .home-card-title {
        font-size: 14px;
    }
    #home-container .home-card-desc {
        font-size: 12px;
    }
    #home-container .home-content h1 {
        font-size: 24px;
    }
    #home-container .home-logo-icon {
        font-size: 34px;
    }
    #home-container .home-footer-links {
        gap: 12px;
    }
    #home-container .home-footer-links a {
        font-size: 12px;
    }

    /* AI 徽章在小屏上缩小 */
    #home-container .home-logo h1 {
        font-size: 26px;
        gap: 8px;
    }
    #home-container .ai-quick-btn {
        font-size: 13px;
        padding: 4px 14px 4px 10px;
    }
    #home-container .ai-quick-btn i {
        font-size: 13px;
    }
}

/* 极小屏（<420px）保持2列，进一步缩小 */
@media (max-width: 420px) {
    #home-container .home-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
    #home-container .home-card {
        padding: 14px 6px 12px;
        border-radius: 10px;
    }
    #home-container .home-card-icon {
        width: 38px;
        height: 38px;
        line-height: 38px;
        font-size: 16px;
    }
    #home-container .home-card-title {
        font-size: 13px;
    }
    #home-container .home-card-desc {
        font-size: 11px;
    }
    #home-container .home-card-tag {
        font-size: 10px;
        padding: 2px 10px;
    }

    #home-container .home-logo h1 {
        font-size: 22px;
    }
    #home-container .ai-quick-btn {
        font-size: 12px;
        padding: 3px 10px 3px 8px;
    }
    #home-container .ai-quick-btn i {
        font-size: 11px;
    }
}

/* ================================================================ */
/* ★★★ AI 快捷入口徽章（标题右侧）- 优化版 ★★★ */
/* ================================================================ */

/* 徽章本体 - 柔和粉紫渐变，文字始终白色 */
#home-container .ai-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 18px 6px 14px;
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: #fff !important;                /* 强制白色，覆盖任何继承 */
    font-size: 15px;
    font-weight: 700;
    border-radius: 50px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(2px);
    white-space: nowrap;
    /* 强制重置文字渲染，避免被 h1 span 的渐变影响 */
    background-clip: unset !important;
    -webkit-text-fill-color: #fff !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);   /* 增加文字阴影提升可读性 */
}

/* 图标颜色与文字一致 */
#home-container .ai-quick-btn i {
    font-size: 15px;
    color: #fff !important;
    filter: drop-shadow(0 0 4px rgba(255,255,255,0.3));
    transition: filter 0.3s;
}

/* 悬停效果：背景色不变，仅上浮 + 阴影加深，文字依然清晰 */
#home-container .ai-quick-btn:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 8px 28px rgba(139, 92, 246, 0.45);
    /* 背景色保持原样，不改变，避免视觉突变 */
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
}

#home-container .ai-quick-btn:hover i {
    filter: drop-shadow(0 0 8px rgba(255,255,255,0.6));
}

/* 点击反馈 */
#home-container .ai-quick-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}





















/* ============================================================================================= */
/* 仿写工作区 - 整体样式 (前缀 mof_)                                                              */
/* ============================================================================================= */

/* ---------- 遮罩层 ---------- */
#mof-editor-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    animation: mof-fadeIn 0.25s ease;
}
#mof-editor-overlay.mof-active {
    display: flex;
}
@keyframes mof-fadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* ---------- 主容器 ---------- */
.mof-editor-container {
    position: relative;
    width: 94vw;
    max-width: 1440px;
    height: 92vh;
    max-height: 900px;
    background: #f8fafc;
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
    user-select: none;
}

/* ---------- 顶部工具栏 ---------- */
.mof-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    background: #ffffff;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    min-height: 56px;
    cursor: move;
    border-radius: 20px 20px 0 0;
    flex-wrap: wrap;
    gap: 8px;
}
.mof-toolbar .mof-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mof-toolbar .mof-title i { color: #4f46e5; }
.mof-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.mof-toolbar-actions button {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.mof-toolbar-actions button:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.mof-toolbar-actions .mof-save-btn {
    background: #4f46e5;
    color: #fff;
    padding: 6px 18px;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
    font-weight: 600;
}
.mof-toolbar-actions .mof-save-btn:hover {
    background: #4338ca;
    box-shadow: 0 6px 24px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}
.mof-toolbar-actions .mof-close-btn { color: #ef4444; }
.mof-toolbar-actions .mof-close-btn:hover { background: #fef2f2; }

/* ---------- 主体（flex 容器） ---------- */
.mof-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    padding: 12px 16px 16px 16px;
    gap: 0;
    background: #f8fafc;
}

/* ---------- 主编辑器（flex 子项，自动伸缩） ---------- */
.mof-main-editor {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #eef2f7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    position: relative;
    z-index: 1;
    transition: flex-basis 0.3s ease;
}

/* ---------- 主标签栏 ---------- */
.mof-main-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 16px 0 16px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.mof-main-tabs .mof-tab-btn {
    padding: 8px 18px;
    border: none;
    background: transparent;
    border-radius: 8px 8px 0 0;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}
.mof-main-tabs .mof-tab-btn:hover {
    color: #0f172a;
    background: #f1f5f9;
}
.mof-main-tabs .mof-tab-btn.active {
    color: #4f46e5;
    background: #ffffff;
    border-bottom-color: #4f46e5;
    font-weight: 600;
}
.mof-side-tabs-container {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding-left: 12px;
    border-left: 2px solid #e2e8f0;
    flex-wrap: wrap;
}
.mof-side-tabs-container .mof-side-tab-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}
.mof-side-tabs-container .mof-side-tab-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.mof-side-tabs-container .mof-side-tab-btn.mof-active {
    background: #eef2ff;
    color: #4f46e5;
    border-color: #c7d2fe;
    font-weight: 600;
}
.mof-side-tabs-container .mof-side-tab-btn.mof-background-btn {
    color: #8b5cf6;
}
.mof-side-tabs-container .mof-side-tab-btn.mof-background-btn.mof-active {
    background: #ede9fe;
    border-color: #a78bfa;
}

/* ---------- 编辑器工具栏 ---------- */
.mof-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    flex-wrap: wrap;
    min-height: 40px;
}
.mof-editor-toolbar button {
    background: transparent;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}
.mof-editor-toolbar button:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.mof-editor-toolbar .mof-side-close-btn {
    margin-left: auto;
    color: #94a3b8;
    font-size: 16px;
    padding: 0 8px;
}
.mof-editor-toolbar .mof-side-close-btn:hover {
    background: #fef2f2;
    color: #ef4444;
}

/* ---------- 主内容区 ---------- */
.mof-main-content,
.mof-side-content {
    flex: 1;
    padding: 12px 16px;
    overflow: auto;
    background: #ffffff;
    min-height: 0;
}
.mof-main-content textarea,
.mof-side-content textarea {
    width: 100%;
    height: 100%;
    border: none;
    padding: 4px 0;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.7;
    resize: none;
    outline: none;
    background: transparent;
    color: #0f172a;
    box-sizing: border-box;
}
.mof-write-area {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.mof-write-area .mof-chapter-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.mof-write-area .mof-chapter-row input {
    flex: 1;
    padding: 6px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
    background: #fafbfc;
    outline: none;
    min-width: 150px;
}
.mof-write-area .mof-chapter-row input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}
.mof-write-area .mof-write-textarea {
    flex: 1;
    min-height: 200px;
    border: 1.5px solid #eef2f7;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.8;
    resize: none;
    outline: none;
    background: #fafbfc;
    transition: border 0.2s;
}
.mof-write-area .mof-write-textarea:focus {
    border-color: #4f46e5;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.05);
}

/* ---------- 工具箱侧边栏（左侧） ---------- */
.mof-toolbox-sidebar {
    order: -1; /* 强制左侧 */
    width: 0;
    overflow: hidden;
    background: #ffffff;
    border-right: 1px solid #eef2f7; /* 右侧分隔线 */
    border-radius: 14px 0 0 14px; /* 左侧圆角 */
    transition: width 0.3s ease;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: none;
    margin-right: 0;
}
.mof-toolbox-sidebar.mof-sidebar-open {
    width: 340px;
    overflow-y: auto;
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.04);
}
.mof-toolbox-sidebar .mof-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
}
.mof-toolbox-sidebar .mof-sidebar-header span {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}
.mof-toolbox-sidebar .mof-sidebar-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
}
.mof-toolbox-sidebar .mof-sidebar-close:hover { color: #ef4444; }
.mof-toolbox-sidebar .mof-sidebar-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.mof-toolbox-sidebar .mof-sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mof-toolbox-sidebar .mof-sidebar-section label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}
.mof-toolbox-sidebar .mof-sidebar-section button,
.mof-toolbox-sidebar .mof-sidebar-section select {
    padding: 8px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #fafbfc;
    font-size: 13px;
    color: #0f172a;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}
.mof-toolbox-sidebar .mof-sidebar-section button:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.mof-toolbox-sidebar .mof-sidebar-hint {
    font-size: 12px;
    color: #94a3b8;
    padding: 4px 0;
}

/* ---------- 副编辑器（浮动面板） ---------- */
.mof-side-editor {
    position: absolute;
    top: 56px;
    right: 12px;
    bottom: 20px;
    width: 420px;
    max-width: 52vw;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #eef2f7;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.08), 0 4px 24px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    transform: translateX(calc(100% + 30px));
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    z-index: 10;
    overflow: hidden;
    padding: 0;
    box-sizing: border-box;
    pointer-events: none;
}
.mof-side-editor.mof-side-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}
.mof-side-content {
    background: #ffffff;
}

/* ---------- 历史记录侧边栏（浮动面板） ---------- */
.mof-history-sidebar {
    position: absolute;
    top: 12px;
    right: 12px;
    bottom: 12px;
    width: 400px;
    max-width: 52vw;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #eef2f7;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.08), 0 4px 24px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    transform: translateX(calc(100% + 30px));
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    z-index: 15;
    overflow: hidden;
    padding: 0;
    box-sizing: border-box;
    pointer-events: none;
}
.mof-history-sidebar.mof-history-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}
.mof-history-sidebar .mof-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
}
.mof-history-sidebar .mof-sidebar-header span {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}
.mof-history-sidebar .mof-sidebar-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
}
.mof-history-sidebar .mof-sidebar-close:hover { color: #ef4444; }
.mof-history-sidebar .mof-sidebar-body {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
    background: #ffffff;
}
.mof-history-sidebar .mof-sidebar-body .mof-history-item {
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mof-history-sidebar .mof-sidebar-body .mof-history-item:last-child {
    border-bottom: none;
}
.mof-history-sidebar .mof-sidebar-body .mof-history-item .info {
    flex: 1;
    min-width: 0;
}
.mof-history-sidebar .mof-sidebar-body .mof-history-item .info .name {
    font-weight: 500;
    font-size: 14px;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mof-history-sidebar .mof-sidebar-body .mof-history-item .info .time {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}
.mof-history-sidebar .mof-sidebar-body .mof-history-item .actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 12px;
}
.mof-history-sidebar .mof-sidebar-body .mof-history-item .actions button {
    padding: 4px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}
.mof-history-sidebar .mof-sidebar-body .mof-history-item .actions .load-btn {
    background: #4f46e5;
    color: #fff;
}
.mof-history-sidebar .mof-sidebar-body .mof-history-item .actions .load-btn:hover {
    background: #4338ca;
}
.mof-history-sidebar .mof-sidebar-body .mof-history-item .actions .del-btn {
    background: #ef4444;
    color: #fff;
}
.mof-history-sidebar .mof-sidebar-body .mof-history-item .actions .del-btn:hover {
    background: #dc2626;
}
.mof-history-sidebar .mof-sidebar-body .empty-tip {
    color: #94a3b8;
    text-align: center;
    padding: 40px 0;
    font-size: 14px;
}

/* ---------- 滚动条 ---------- */
.mof-main-content::-webkit-scrollbar,
.mof-side-content::-webkit-scrollbar,
.mof-toolbox-sidebar .mof-sidebar-body::-webkit-scrollbar,
.mof-history-sidebar .mof-sidebar-body::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
.mof-main-content::-webkit-scrollbar-track,
.mof-side-content::-webkit-scrollbar-track,
.mof-toolbox-sidebar .mof-sidebar-body::-webkit-scrollbar-track,
.mof-history-sidebar .mof-sidebar-body::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 8px;
}
.mof-main-content::-webkit-scrollbar-thumb,
.mof-side-content::-webkit-scrollbar-thumb,
.mof-toolbox-sidebar .mof-sidebar-body::-webkit-scrollbar-thumb,
.mof-history-sidebar .mof-sidebar-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 8px;
}
.mof-main-content::-webkit-scrollbar-thumb:hover,
.mof-side-content::-webkit-scrollbar-thumb:hover,
.mof-toolbox-sidebar .mof-sidebar-body::-webkit-scrollbar-thumb:hover,
.mof-history-sidebar .mof-sidebar-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ---------- 缩放手柄 ---------- */
.mof-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #94a3b8 50%);
    border-radius: 0 0 20px 0;
    z-index: 20;
    pointer-events: auto;
    transition: all 0.2s;
}
.mof-resize-handle:hover {
    background: linear-gradient(135deg, transparent 50%, #4f46e5 50%);
    width: 24px;
    height: 24px;
    box-shadow: 0 0 16px rgba(79, 70, 229, 0.3);
}

/* ---------- 全屏 ---------- */
.mof-editor-container.mof-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
}

/* ---------- Toast 消息 ---------- */
.mof-toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 999999;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    animation: mof-toast-in 0.3s ease;
}
@keyframes mof-toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* ---------- 浮动窗口系统 ---------- */
.mof-window-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 100000;
    overflow: hidden;
}
.mof-window-container .mof-window {
    position: absolute;
    min-width: 320px;
    min-height: 200px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.30);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    animation: mof-window-in 0.25s ease;
    overflow: hidden;
    backdrop-filter: blur(2px);
}
@keyframes mof-window-in {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
.mof-window .mof-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    cursor: move;
    user-select: none;
    border-radius: 16px 16px 0 0;
    min-height: 44px;
}
.mof-window .mof-window-header .mof-window-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mof-window .mof-window-header .mof-window-title i {
    color: #4f46e5;
}
.mof-window .mof-window-header .mof-window-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 6px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
}
.mof-window .mof-window-header .mof-window-close:hover {
    background: #fef2f2;
    color: #ef4444;
}
.mof-window .mof-window-body {
    flex: 1;
    padding: 16px;
    overflow: auto;
    background: #ffffff;
    font-size: 14px;
    line-height: 1.7;
    color: #0f172a;
}
.mof-window .mof-window-body textarea {
    width: 100%;
    height: 100%;
    border: 1.5px solid #eef2f7;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.7;
    resize: none;
    outline: none;
    background: #fafbfc;
    transition: border 0.2s;
    box-sizing: border-box;
    color: #0f172a;
}
.mof-window .mof-window-body textarea:focus {
    border-color: #4f46e5;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.05);
}
.mof-window .mof-window-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #cbd5e1 50%);
    border-radius: 0 0 16px 0;
    z-index: 5;
    pointer-events: auto;
    transition: all 0.2s;
}
.mof-window .mof-window-resize:hover {
    background: linear-gradient(135deg, transparent 50%, #4f46e5 50%);
    width: 22px;
    height: 22px;
}
.mof-window.mof-window-raise {
    transition: box-shadow 0.2s ease;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.40);
}

/* ---------- 模态框系统 ---------- */
.mof-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    z-index: 200000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: mof-modal-overlay-in 0.25s ease;
    pointer-events: auto;
}
@keyframes mof-modal-overlay-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.mof-modal-overlay.mof-modal-closing {
    animation: mof-modal-overlay-out 0.2s ease forwards;
}
@keyframes mof-modal-overlay-out {
    to { opacity: 0; }
}
.mof-modal {
    background: #ffffff;
    border-radius: 20px;
    max-width: 520px;
    width: 92%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
    animation: mof-modal-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    position: relative;
}
@keyframes mof-modal-in {
    from {
        opacity: 0;
        transform: scale(0.88) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
.mof-modal .mof-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px 20px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
}
.mof-modal .mof-modal-header .mof-modal-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}
.mof-modal .mof-modal-header .mof-modal-title i {
    color: #4f46e5;
}
.mof-modal .mof-modal-header .mof-modal-close {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
}
.mof-modal .mof-modal-header .mof-modal-close:hover {
    background: #fef2f2;
    color: #ef4444;
}
.mof-modal .mof-modal-body {
    padding: 20px 20px 16px 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 14px;
    line-height: 1.8;
    color: #1e293b;
}
.mof-modal .mof-modal-body .mof-modal-message {
    margin-bottom: 8px;
}
.mof-modal .mof-modal-body .mof-modal-detail {
    font-size: 13px;
    color: #64748b;
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #eef2f7;
    margin-top: 8px;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}
.mof-modal .mof-modal-progress {
    padding: 0 20px 12px 20px;
    flex-shrink: 0;
}
.mof-modal .mof-modal-progress .mof-modal-progress-track {
    width: 100%;
    height: 6px;
    background: #eef2f7;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.mof-modal .mof-modal-progress .mof-modal-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}
.mof-modal .mof-modal-progress .mof-modal-progress-label {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
    text-align: right;
}
.mof-modal .mof-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px 16px 20px;
    background: #fafbfc;
    border-top: 1px solid #eef2f7;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.mof-modal .mof-modal-footer .mof-modal-btn {
    padding: 8px 22px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 72px;
    text-align: center;
}
.mof-modal .mof-modal-footer .mof-modal-btn:hover {
    transform: translateY(-1px);
}
.mof-modal .mof-modal-footer .mof-modal-btn:active {
    transform: scale(0.97);
}
.mof-modal .mof-modal-footer .mof-modal-btn.mof-modal-btn-primary {
    background: #4f46e5;
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}
.mof-modal .mof-modal-footer .mof-modal-btn.mof-modal-btn-primary:hover {
    background: #4338ca;
    box-shadow: 0 6px 24px rgba(79, 70, 229, 0.35);
}
.mof-modal .mof-modal-footer .mof-modal-btn.mof-modal-btn-secondary {
    background: #f1f5f9;
    color: #475569;
}
.mof-modal .mof-modal-footer .mof-modal-btn.mof-modal-btn-secondary:hover {
    background: #e2e8f0;
}
.mof-modal .mof-modal-footer .mof-modal-btn.mof-modal-btn-danger {
    background: #ef4444;
    color: #fff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
}
.mof-modal .mof-modal-footer .mof-modal-btn.mof-modal-btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 6px 24px rgba(239, 68, 68, 0.35);
}
.mof-modal .mof-modal-footer .mof-modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .mof-side-editor {
        width: 360px;
        max-width: 60vw;
    }
    .mof-toolbox-sidebar.mof-sidebar-open {
        width: 280px;
    }
    .mof-toolbar .mof-title {
        font-size: 16px;
    }
    .mof-toolbar-actions button {
        font-size: 12px;
        padding: 4px 10px;
    }
    .mof-main-tabs .mof-tab-btn {
        font-size: 13px;
        padding: 6px 12px;
    }
    .mof-write-area .mof-chapter-row {
        flex-direction: column;
        gap: 8px;
    }
    .mof-side-tabs-container .mof-side-tab-btn {
        font-size: 12px;
        padding: 4px 10px;
    }
    .mof-history-sidebar {
        width: 320px;
    }
}
@media (max-width: 640px) {
    .mof-editor-container {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    .mof-toolbar {
        border-radius: 0;
        padding: 8px 12px;
        min-height: 48px;
    }
    .mof-body {
        padding: 8px;
    }
    .mof-side-editor {
        width: 88vw;
        max-width: 88vw;
        right: 6px;
        top: 6px;
        bottom: 6px;
    }
    .mof-toolbox-sidebar.mof-sidebar-open {
        width: 76vw;
    }
    .mof-main-tabs .mof-tab-btn {
        font-size: 12px;
        padding: 4px 10px;
    }
    .mof-history-sidebar {
        width: 88vw;
        max-width: 88vw;
        right: 6px;
        top: 6px;
        bottom: 6px;
    }
    .mof-modal {
        max-width: 96%;
        border-radius: 16px;
        max-height: 90vh;
    }
    .mof-modal .mof-modal-header {
        padding: 12px 16px 10px 16px;
    }
    .mof-modal .mof-modal-header .mof-modal-title {
        font-size: 15px;
    }
    .mof-modal .mof-modal-body {
        padding: 14px 16px 12px 16px;
        font-size: 13px;
    }
    .mof-modal .mof-modal-footer {
        padding: 10px 16px 14px 16px;
    }
    .mof-modal .mof-modal-footer .mof-modal-btn {
        padding: 6px 16px;
        font-size: 13px;
        min-width: 60px;
    }
    .mof-window .mof-window {
        min-width: 260px;
        min-height: 160px;
    }
    .mof-window .mof-window-header {
        padding: 8px 12px;
        min-height: 38px;
    }
    .mof-window .mof-window-header .mof-window-title {
        font-size: 13px;
    }
    .mof-window .mof-window-body {
        padding: 12px;
        font-size: 13px;
    }
}
#mof-welcome button {
    transition: all 0.2s ease;
}

.mof-modal .mof-modal-body {
    pointer-events: auto;
}
.mof-modal .mof-modal-body input,
.mof-modal .mof-modal-body textarea {
    pointer-events: auto !important;
}

/* 让卡片管理侧边栏显示在欢迎页之上 */
.mof-history-sidebar {
    z-index: 60 !important;  /* 高于欢迎页的 50 */
}






/* ============================================================
   交易中心工作区样式（前缀 trade_）
   ============================================================ */

/* ---------- 遮罩层 ---------- */
#trade-editor-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index: 99998;
    justify-content: center;
    align-items: center;
    animation: trade-fadeIn 0.25s ease;
}
#trade-editor-overlay.trade-active {
    display: flex;
}
@keyframes trade-fadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}

/* ---------- 主容器 ---------- */
.trade-editor-container {
    position: relative;
    width: 94vw;
    max-width: 1440px;
    height: 92vh;
    max-height: 900px;
    background: #f8fafc;
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.2s ease;
    user-select: none;
}

/* ---------- 顶部工具栏 ---------- */
.trade-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    background: #ffffff;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    min-height: 56px;
    cursor: move;
    border-radius: 20px 20px 0 0;
    flex-wrap: wrap;
    gap: 8px;
}
.trade-toolbar .trade-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}
.trade-toolbar .trade-title i { color: #4f46e5; }
.trade-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.trade-toolbar-actions .trade-main-tabs {
    display: flex;
    gap: 2px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
}
.trade-main-tabs .trade-tab-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
}
.trade-main-tabs .trade-tab-btn:hover {
    background: rgba(255,255,255,0.6);
    color: #0f172a;
}
.trade-main-tabs .trade-tab-btn.active {
    background: #ffffff;
    color: #4f46e5;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.trade-toolbar-actions button {
    background: transparent;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.trade-toolbar-actions button:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.trade-toolbar-actions .trade-publish-btn {
    background: #4f46e5;
    color: #fff;
    padding: 6px 18px;
    box-shadow: 0 4px 14px rgba(79,70,229,0.25);
    font-weight: 600;
}
.trade-toolbar-actions .trade-publish-btn:hover {
    background: #4338ca;
    box-shadow: 0 6px 24px rgba(79,70,229,0.35);
    transform: translateY(-1px);
}
.trade-toolbar-actions .trade-close-btn { color: #ef4444; }
.trade-toolbar-actions .trade-close-btn:hover { background: #fef2f2; }

/* ---------- 主体 flex 容器 ---------- */
.trade-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    padding: 12px 16px 16px 16px;
    background: #f8fafc;
}

/* ---------- 左侧边栏（个人中心） ---------- */
.trade-left-sidebar {
    order: -1;
    width: 0;
    overflow: hidden;
    background: #ffffff;
    border-right: 1px solid #eef2f7;
    border-radius: 14px 0 0 14px;
    transition: width 0.3s ease;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: none;
}
.trade-left-sidebar.trade-sidebar-open {
    width: 320px;
    overflow-y: auto;
    box-shadow: 4px 0 16px rgba(0,0,0,0.04);
}
.trade-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
}
.trade-sidebar-header span {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
}
.trade-sidebar-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
}
.trade-sidebar-close:hover { color: #ef4444; }
.trade-sidebar-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ---------- 中间主内容 ---------- */
.trade-main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #eef2f7;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    overflow: hidden;
    position: relative;
    padding: 16px;
}
.trade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    flex: 1;
    align-content: start;
    overflow-y: auto;
    padding: 4px 0;
}
.trade-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #eef2f7;
    overflow: hidden;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
}
.trade-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}
.trade-card-cover {
    width: 100%;
    height: 140px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #94a3b8;
    overflow: hidden;
}
.trade-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.trade-card-body {
    padding: 12px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.trade-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.trade-card-desc {
    font-size: 13px;
    color: #64748b;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
    margin-bottom: 8px;
}
.trade-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 8px;
    font-size: 13px;
    color: #475569;
}
.trade-card-price {
    font-weight: 700;
    color: #4f46e5;
    font-size: 15px;
}
.trade-card-actions {
    display: flex;
    gap: 6px;
}
.trade-card-actions button {
    background: transparent;
    border: none;
    padding: 2px 8px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #64748b;
}
.trade-card-actions .like-btn { color: #4f46e5; }
.trade-card-actions .like-btn:hover { background: #eef2ff; }
.trade-card-actions .dislike-btn { color: #ef4444; }
.trade-card-actions .dislike-btn:hover { background: #fef2f2; }

/* ---------- 右侧边栏（交易信息） ---------- */
.trade-right-sidebar {
    width: 0;
    overflow: hidden;
    background: #ffffff;
    border-left: 1px solid #eef2f7;
    border-radius: 0 14px 14px 0;
    transition: width 0.3s ease;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.trade-right-sidebar.trade-sidebar-open {
    width: 340px;
    overflow-y: auto;
    box-shadow: -4px 0 16px rgba(0,0,0,0.04);
}
.trade-right-sidebar .trade-sidebar-body {
    padding: 12px 16px;
}
.trade-transaction-item {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.trade-transaction-item:last-child { border-bottom: none; }
.trade-transaction-item .info {
    flex: 1;
    min-width: 0;
}
.trade-transaction-item .info .name {
    font-weight: 500;
    font-size: 14px;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.trade-transaction-item .info .meta {
    font-size: 12px;
    color: #94a3b8;
}
.trade-transaction-item .status {
    font-size: 12px;
    font-weight: 500;
    padding: 2px 10px;
    border-radius: 12px;
    flex-shrink: 0;
    margin-left: 8px;
}
.trade-transaction-item .status.pending { background: #fef3c7; color: #d97706; }
.trade-transaction-item .status.confirmed { background: #d1fae5; color: #065f46; }
.trade-transaction-item .status.cancelled { background: #fee2e2; color: #991b1b; }
.trade-transaction-item .actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.trade-transaction-item .actions button {
    padding: 2px 10px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
    background: #eef2ff;
    color: #4f46e5;
}
.trade-transaction-item .actions button:hover { background: #4f46e5; color: #fff; }

/* ---------- 滚动条 ---------- */
.trade-sidebar-body::-webkit-scrollbar,
.trade-grid::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
.trade-sidebar-body::-webkit-scrollbar-track,
.trade-grid::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 8px;
}
.trade-sidebar-body::-webkit-scrollbar-thumb,
.trade-grid::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 8px;
}
.trade-sidebar-body::-webkit-scrollbar-thumb:hover,
.trade-grid::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ---------- 缩放手柄 ---------- */
.trade-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #94a3b8 50%);
    border-radius: 0 0 20px 0;
    z-index: 20;
    pointer-events: auto;
    transition: all 0.2s;
}
.trade-resize-handle:hover {
    background: linear-gradient(135deg, transparent 50%, #4f46e5 50%);
    width: 24px;
    height: 24px;
    box-shadow: 0 0 16px rgba(79,70,229,0.3);
}

/* ---------- 全屏 ---------- */
.trade-editor-container.trade-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
}

/* ---------- 浮动窗口系统（复用 mof 的窗口） ---------- */
.trade-window-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 100000;
    overflow: hidden;
}
.trade-window-container .trade-window {
    position: absolute;
    min-width: 320px;
    min-height: 200px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.30);
    border: 1px solid rgba(255,255,255,0.12);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    animation: trade-window-in 0.25s ease;
    overflow: hidden;
    backdrop-filter: blur(2px);
}
@keyframes trade-window-in {
    from { opacity: 0; transform: scale(0.92) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.trade-window .trade-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    cursor: move;
    user-select: none;
    border-radius: 16px 16px 0 0;
    min-height: 44px;
}
.trade-window .trade-window-header .trade-window-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}
.trade-window .trade-window-header .trade-window-title i { color: #4f46e5; }
.trade-window .trade-window-header .trade-window-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 6px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
}
.trade-window .trade-window-header .trade-window-close:hover {
    background: #fef2f2;
    color: #ef4444;
}
.trade-window .trade-window-body {
    flex: 1;
    padding: 16px;
    overflow: auto;
    background: #ffffff;
    font-size: 14px;
    line-height: 1.7;
    color: #0f172a;
}
.trade-window .trade-window-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #cbd5e1 50%);
    border-radius: 0 0 16px 0;
    z-index: 5;
    pointer-events: auto;
    transition: all 0.2s;
}
.trade-window .trade-window-resize:hover {
    background: linear-gradient(135deg, transparent 50%, #4f46e5 50%);
    width: 22px;
    height: 22px;
}

/* ---------- Toast ---------- */
.trade-toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15,23,42,0.92);
    color: #fff;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999999;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.06);
    animation: trade-toast-in 0.3s ease;
}
@keyframes trade-toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .trade-left-sidebar.trade-sidebar-open { width: 260px; }
    .trade-right-sidebar.trade-sidebar-open { width: 280px; }
    .trade-main-tabs .trade-tab-btn { font-size: 12px; padding: 4px 12px; }
    .trade-toolbar .trade-title { font-size: 16px; }
}
@media (max-width: 640px) {
    .trade-editor-container { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
    .trade-toolbar { border-radius: 0; padding: 6px 12px; min-height: 48px; }
    .trade-body { padding: 6px; }
    .trade-left-sidebar.trade-sidebar-open { width: 220px; }
    .trade-right-sidebar.trade-sidebar-open { width: 220px; }
    .trade-main-tabs .trade-tab-btn { font-size: 11px; padding: 3px 8px; }
    .trade-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
    .trade-card-cover { height: 100px; }
}

/* ---------- 侧边栏切换按钮 ---------- */
.trade-sidebar-toggle {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.trade-sidebar-toggle:hover {
    background: #f1f5f9;
    color: #0f172a;
}
.trade-sidebar-toggle.active {
    background: #eef2ff;
    color: #4f46e5;
    box-shadow: 0 1px 3px rgba(79,70,229,0.15);
}
.trade-sidebar-toggle i {
    font-size: 15px;
}

/* 卡片发布者样式 */
.trade-card-seller {
    font-size: 13px;
    color: #64748b;
    margin: 4px 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px dashed #eef2f7;
}
.trade-card-seller span {
    color: #334155;
    font-weight: 500;
}

/* ============================================================
   交易卡片 - 统一大小
   ============================================================ */

/* 卡片网格容器 */
.trade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    flex: 1;
    align-content: start;
    overflow-y: auto;
    padding: 4px 0;
}

/* 单个卡片 - 固定高度 380px */
.trade-card {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #eef2f7;
    overflow: hidden;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    height: 380px;           /* ★ 固定高度 ★ */
    cursor: pointer;         /* ★ 点击打开详情 ★ */
}

.trade-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

/* 封面图 - 固定 140px */
.trade-card-cover {
    width: 100%;
    height: 140px;
    flex-shrink: 0;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: #94a3b8;
    overflow: hidden;
}
.trade-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 卡片内容区 - flex:1 占满剩余空间 */
.trade-card-body {
    padding: 12px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;           /* 防止 flex 溢出 */
}

/* 标题 - 固定一行，超出省略 */
.trade-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

/* 描述 - 固定两行，超出省略（约 50 字） */
.trade-card-desc {
    font-size: 13px;
    color: #64748b;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    flex: 1;                     /* 占满剩余空间 */
    min-height: 40px;
}

/* 发布者 - 固定一行 */
.trade-card-seller {
    font-size: 12px;
    color: #94a3b8;
    padding-top: 4px;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.trade-card-seller span {
    color: #475569;
    font-weight: 500;
}

/* 底部 - 价格 + 按钮，固定高度 */
.trade-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
    flex-shrink: 0;
    min-height: 44px;
}
.trade-card-price {
    font-weight: 700;
    color: #4f46e5;
    font-size: 15px;
}
.trade-card-actions {
    display: flex;
    gap: 6px;
}
.trade-card-actions button {
    background: transparent;
    border: none;
    padding: 2px 8px;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    color: #64748b;
}
.trade-card-actions .like-btn { color: #4f46e5; }
.trade-card-actions .like-btn:hover { background: #eef2ff; }
.trade-card-actions .dislike-btn { color: #ef4444; }
.trade-card-actions .dislike-btn:hover { background: #fef2f2; }

/* 详情弹窗 - 完整描述 */
.trade-detail-description {
    font-size: 14px;
    line-height: 1.8;
    color: #1e293b;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #eef2f7;
    margin: 8px 0 12px 0;
}












/* ============================================================================================= */
/* ===== 一键大纲窗口 ===== */
#yjdg_window {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    height: 92%;
    max-width: 1440px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    z-index: 10002;
    overflow: hidden;
    border-radius: 12px;
}

#yjdg_window.active {
    display: flex;
}

#yjdg_window.fullscreen-mode {
    transform: none !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
}

/* ===== 顶部工具栏 ===== */
#yjdg-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 14px;
    background: #f8fafc;
    border-bottom: 2px solid #eef2f7;
    min-height: 50px;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

#yjdg-toolbar .toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#yjdg-toolbar .toolbar-center {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
}

#yjdg-toolbar .toolbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.toolbar-btn {
    height: 34px;
    padding: 0 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    border: none;
    line-height: 1;
    background: #f1f5f9;
    color: #334155;
}

.toolbar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

.toolbar-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

.toolbar-btn.primary {
    background: #4f46e5;
    color: #fff;
}

.toolbar-btn.primary:hover {
    background: #4338ca;
}

.toolbar-btn.success {
    background: #22c55e;
    color: #fff;
}

.toolbar-btn.success:hover {
    background: #16a34a;
}

.toolbar-btn.danger {
    background: #ef4444;
    color: #fff;
}

.toolbar-btn.danger:hover {
    background: #dc2626;
}

.toolbar-btn.warning {
    background: #f59e0b;
    color: #fff;
}

.toolbar-btn.warning:hover {
    background: #d97706;
}

.toolbar-btn.outline {
    background: transparent;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.toolbar-btn.outline:hover {
    background: #f1f5f9;
}

.toolbar-btn .icon {
    font-size: 14px;
}

.toolbar-divider {
    width: 1px;
    height: 28px;
    background: #e2e8f0;
    margin: 0 4px;
}

.toolbar-title {
    font-weight: 600;
    font-size: 15px;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-title .badge {
    font-size: 10px;
    background: #eef2ff;
    color: #4f46e5;
    padding: 0 8px;
    border-radius: 10px;
    font-weight: 500;
}

#charCount {
    min-width: 56px;
    text-align: center;
    background: #f1f5f9;
    color: #475569;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0 10px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

.sidebar-toggle-btn {
    height: 34px;
    padding: 0 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.sidebar-toggle-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.sidebar-toggle-btn.active {
    background: #eef2ff;
    border-color: #4f46e5;
    color: #4f46e5;
}

#topHistoryCount {
    font-size: 12px;
    color: #475569;
    background: #f1f5f9;
    padding: 0 10px;
    border-radius: 12px;
    line-height: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    border: 1px solid #e2e8f0;
}

/* ===== 三栏主体 ===== */
.yjdg-flex-row {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===== 左侧工具箱 ===== */
#yjdg-toolbox {
    width: 0;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f8fafc;
    border-right: 1px solid #eef2f7;
    display: flex;
    flex-direction: column;
    height: 100%;
}

#yjdg-toolbox.open {
    width: 400px;
}

#yjdg-toolbox .toolbox-inner {
    width: 400px;
    height: 100%;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f8fafc;
    overflow: hidden;
}

#yjdg-toolbox.open .toolbox-inner {
    transform: translateX(0);
}

.toolbox-header {
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbox-header .close-toolbox {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #94a3b8;
    padding: 0 4px;
}

.toolbox-header .close-toolbox:hover {
    color: #475569;
}

.toolbox-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.yjdg-module {
    background: #fff;
    border-radius: 10px;
    padding: 14px 16px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    transition: border-color 0.2s;
}

.yjdg-module:hover {
    border-color: #e2e8f0;
}

.yjdg-module-title {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.yjdg-module-title .required {
    color: #ef4444;
    font-size: 14px;
}

.yjdg-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.7;
    font-family: inherit;
    resize: vertical;
    background: #fafbfc;
    color: #1e293b;
    transition: border-color 0.2s;
}

.yjdg-textarea:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
    background: #fff;
}

.yjdg-select-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.yjdg-select-row select,
.yjdg-select-row input[type="text"] {
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    background: #fff;
    color: #1e293b;
    outline: none;
    transition: border-color 0.2s;
    height: 36px;
}

.yjdg-select-row select:focus,
.yjdg-select-row input[type="text"]:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.06);
}

.yjdg-select-row select {
    min-width: 80px;
    cursor: pointer;
}

.yjdg-select-row input[type="text"] {
    flex: 1;
    min-width: 100px;
}

.yjdg-btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.yjdg-btn-group .yjdg-btn {
    padding: 6px 18px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.yjdg-btn-group .yjdg-btn-primary {
    background: #4f46e5;
    color: #fff;
}

.yjdg-btn-group .yjdg-btn-primary:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

.yjdg-btn-group .yjdg-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.yjdg-btn-group .yjdg-btn-secondary:hover {
    background: #e2e8f0;
}

.yjdg-btn-group .yjdg-btn-danger {
    background: #ef4444;
    color: #fff;
}

.yjdg-btn-group .yjdg-btn-danger:hover {
    background: #dc2626;
}

.yjdg-hidden {
    display: none !important;
}

/* ===== 中间内容区 ===== */
.yjdg-content-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
    min-width: 0;
}

.yjdg-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 6px;
}

.yjdg-content-header .mode-tabs {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 8px;
}

.yjdg-content-header .mode-tab {
    padding: 4px 16px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    color: #64748b;
    transition: all 0.2s;
}

.yjdg-content-header .mode-tab.active {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.yjdg-content-header .mode-tab:hover:not(.active) {
    color: #1e293b;
}

.yjdg-content-header .header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.yjdg-content-header .header-actions .mini-btn {
    padding: 2px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #fff;
    font-size: 12px;
    cursor: pointer;
    color: #475569;
    transition: all 0.2s;
}

.yjdg-content-header .header-actions .mini-btn:hover {
    background: #f1f5f9;
}

.yjdg-content-body {
    flex: 1;
    overflow-y: auto;
    background: #fff;
    padding: 0;
    position: relative;
}

/* 新的内容区：章节导航 + 文本域 */
.yjdg-content-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

#yjdg-chapter-nav {
    display: flex;
    gap: 6px;
    padding: 8px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #eef2f7;
    flex-wrap: wrap;
    align-items: center;
    flex-shrink: 0;
}

#yjdg-chapter-nav .chapter-btn {
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    transition: all 0.2s;
}

#yjdg-chapter-nav .chapter-btn:hover {
    background: #eef2ff;
    border-color: #4f46e5;
}

#yjdg-chapter-nav .chapter-btn.active {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

.yjdg-editor-area {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.yjdg-editor-area textarea {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    padding: 16px 20px;
    font-size: 15px;
    line-height: 2;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    resize: none;
    background: #fff;
    color: #1e293b;
    box-sizing: border-box;
}

/* 预览模式（保持兼容） */
#writing-content {
    display: none;
    height: 100%;
    flex-direction: column;
}

#writing-content.active {
    display: flex;
}

.scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.output-content {
    max-width: 100%;
}

#output {
    font-size: 15px;
    line-height: 2;
    color: #1e293b;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ===== 右侧历史侧边栏 ===== */
#yjdg-chapter-sidebar {
    width: 0;
    flex-shrink: 0;
    overflow: hidden;
    transition: width 0.35s ease;
    background: #f8fafc;
    border-left: 1px solid #eef2f7;
    display: flex;
    flex-direction: column;
    height: 100%;
}

#yjdg-chapter-sidebar.open {
    width: 340px;
}

.yjdg-sidebar-inner {
    width: 340px;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    overflow: hidden;
}

.yjdg-sidebar-header {
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.yjdg-sidebar-header .count-badge {
    font-size: 12px;
    color: #94a3b8;
}

.yjdg-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    background: #f8fafc;
}

.yjdg-history-item {
    background: #fff;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    border: 1px solid #f1f5f9;
    transition: border-color 0.2s;
}

.yjdg-history-item:hover {
    border-color: #d1d5db;
}

.yjdg-history-item .item-time {
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 2px;
}

.yjdg-history-item .item-title {
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
    margin-bottom: 4px;
    cursor: pointer;
}

.yjdg-history-item .item-title:hover {
    color: #4f46e5;
}

.yjdg-history-item .item-meta {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 6px;
}

.yjdg-history-item .item-buttons {
    display: flex;
    gap: 6px;
}

.yjdg-history-item .item-buttons button {
    padding: 2px 12px;
    border-radius: 4px;
    font-size: 12px;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.yjdg-history-item .btn-load {
    background: #eef2ff;
    color: #4f46e5;
}

.yjdg-history-item .btn-load:hover {
    background: #c7d2fe;
}

.yjdg-history-item .btn-delete {
    background: #fee2e2;
    color: #ef4444;
}

.yjdg-history-item .btn-delete:hover {
    background: #fecaca;
}

.history-empty {
    text-align: center;
    color: #94a3b8;
    padding: 40px 20px;
    font-size: 14px;
}

.history-empty .icon {
    font-size: 32px;
    display: block;
    margin-bottom: 12px;
}

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    #yjdg-toolbox.open {
        width: 340px;
    }

    #yjdg-toolbox .toolbox-inner {
        width: 340px;
    }

    #yjdg-chapter-sidebar.open {
        width: 280px;
    }

    .yjdg-sidebar-inner {
        width: 280px;
    }
}

@media (max-width: 768px) {
    #yjdg_window {
        width: 98%;
        height: 96%;
        border-radius: 8px;
    }

    #yjdg-toolbar {
        flex-wrap: wrap;
        gap: 4px;
        padding: 4px 10px;
        min-height: 44px;
    }

    #yjdg-toolbar .toolbar-center {
        order: 3;
        flex-basis: 100%;
        justify-content: flex-start;
        gap: 4px;
        padding-top: 2px;
    }

    .toolbar-btn {
        height: 30px;
        padding: 0 8px;
        font-size: 11px;
    }

    .toolbar-title {
        font-size: 13px;
    }

    .toolbar-btn .btn-label {
        display: none;
    }

    #charCount {
        height: 30px;
        font-size: 11px;
        padding: 0 8px;
        min-width: 44px;
    }

    .sidebar-toggle-btn {
        height: 30px;
        padding: 0 8px;
        font-size: 11px;
    }

    #yjdg-toolbox.open {
        width: 280px;
    }

    #yjdg-toolbox .toolbox-inner {
        width: 280px;
    }

    #yjdg-chapter-sidebar.open {
        width: 240px;
    }

    .yjdg-sidebar-inner {
        width: 240px;
    }

    .toolbox-body {
        padding: 10px 12px 16px;
        gap: 10px;
    }

    .yjdg-module {
        padding: 10px 12px;
    }

    .yjdg-select-row {
        flex-direction: column;
        align-items: stretch;
    }

    .yjdg-select-row select,
    .yjdg-select-row input[type="text"] {
        width: 100%;
    }

    .yjdg-content-header {
        padding: 6px 12px;
    }

    .yjdg-content-header .mode-tabs {
        flex-wrap: wrap;
    }

    .yjdg-content-header .mode-tab {
        padding: 2px 10px;
        font-size: 11px;
    }

    .yjdg-editor-area textarea {
        padding: 12px 14px;
        font-size: 14px;
    }

    .scroll-area {
        padding: 12px 14px;
    }

    #output {
        font-size: 14px;
    }

    #topHistoryCount {
        font-size: 11px;
        padding: 0 6px;
        height: 24px;
        line-height: 24px;
    }

    .yjdg-history-item .item-buttons button {
        font-size: 10px;
        padding: 1px 8px;
    }
}

@media (max-width: 480px) {
    #yjdg-toolbox.open {
        width: 220px;
    }

    #yjdg-toolbox .toolbox-inner {
        width: 220px;
    }

    #yjdg-chapter-sidebar.open {
        width: 200px;
    }

    .yjdg-sidebar-inner {
        width: 200px;
    }

    .toolbar-btn {
        padding: 0 6px;
        font-size: 10px;
        height: 26px;
    }

    .toolbar-btn .icon {
        font-size: 12px;
    }

    #charCount {
        height: 26px;
        font-size: 10px;
        padding: 0 6px;
        min-width: 36px;
    }

    .sidebar-toggle-btn {
        height: 26px;
        padding: 0 6px;
        font-size: 10px;
    }
}

/* ===== 卡片选择器 ===== */
.yjdg-card-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 20px;
    background: #fafbfc;
    text-align: center;
    min-height: 400px;
}

.yjdg-card-selector-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.yjdg-card-selector-title {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.yjdg-card-selector-sub {
    font-size: 15px;
    color: #64748b;
    margin-bottom: 24px;
    max-width: 420px;
    line-height: 1.6;
}

.yjdg-card-selector-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 28px;
}

.yjdg-action-btn {
    padding: 10px 28px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.yjdg-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.yjdg-action-btn.yjdg-primary {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

.yjdg-action-btn.yjdg-primary:hover {
    background: #4338ca;
    border-color: #4338ca;
}

.yjdg-action-btn.yjdg-secondary {
    background: #fff;
    color: #475569;
    border-color: #e2e8f0;
}

.yjdg-action-btn.yjdg-secondary:hover {
    background: #f8fafc;
}

.yjdg-card-selector-divider {
    width: 80px;
    height: 2px;
    background: #e2e8f0;
    margin-bottom: 20px;
}

.yjdg-card-selector-list {
    width: 100%;
    max-width: 480px;
    text-align: left;
}

.yjdg-list-label {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    display: block;
    margin-bottom: 10px;
    padding-left: 2px;
}

.yjdg-card-item-mini {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.yjdg-card-item-mini:hover {
    border-color: #cbd5e1;
    background: #fafbfc;
}

.yjdg-card-item-mini .info {
    flex: 1;
    min-width: 0;
}

.yjdg-card-item-mini .name {
    font-weight: 500;
    font-size: 14px;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.yjdg-card-item-mini .time {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 1px;
}

.yjdg-card-item-mini .load-mini-btn {
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    background: #eef2ff;
    color: #4f46e5;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
    margin-left: 10px;
}

.yjdg-card-item-mini .load-mini-btn:hover {
    background: #c7d2fe;
}

.empty-tip-sm {
    color: #94a3b8;
    font-size: 14px;
    padding: 20px 0;
    text-align: center;
}

/* ===== 侧边栏新建卡片按钮 ===== */
.yjdg-new-card-btn {
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    background: #4f46e5;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.yjdg-new-card-btn:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

.yjdg-new-card-btn i {
    font-size: 13px;
}

/* ===== 编辑器区域包装 ===== */
.yjdg-editor-area-wrapper {
    display: none;
    flex-direction: column;
    height: 100%;
}

.yjdg-editor-area-wrapper.active {
    display: flex;
}

/* ===== Toast ===== */
.yjdg-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 28px;
    background: #1e293b;
    color: #f8fafc;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 999999;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    animation: yjdgToastIn 0.3s ease;
    max-width: 90%;
    text-align: center;
}

@keyframes yjdgToastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* ===== 响应式调整 ===== */
@media (max-width: 768px) {
    .yjdg-card-selector-title {
        font-size: 20px;
    }

    .yjdg-card-selector-sub {
        font-size: 14px;
        padding: 0 12px;
    }

    .yjdg-action-btn {
        padding: 8px 20px;
        font-size: 14px;
    }

    .yjdg-card-selector-icon {
        font-size: 48px;
    }

    .yjdg-new-card-btn {
        padding: 3px 10px;
        font-size: 11px;
    }

    .yjdg-new-card-btn span {
        display: none;
    }

    .yjdg-card-item-mini .name {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .yjdg-card-selector {
        padding: 24px 12px;
        min-height: 300px;
    }

    .yjdg-card-selector-title {
        font-size: 18px;
    }

    .yjdg-card-selector-actions {
        flex-direction: column;
        width: 100%;
        max-width: 280px;
    }

    .yjdg-action-btn {
        justify-content: center;
        padding: 10px 16px;
        font-size: 13px;
        width: 100%;
    }
}

/* 标题输入区样式 */
#yjdg-chapter-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    flex-wrap: wrap;
}

#yjdg-chapter-nav input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: #ffffff;
}

#yjdg-chapter-nav #yjdg-update-title-btn:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

#yjdg-chapter-nav #yjdg-update-title-btn:active {
    transform: translateY(0);
}

#yjdg-title-status {
    font-size: 12px;
    color: #94a3b8;
    min-width: 60px;
    transition: color 0.2s;
}

/* 卡片选择器样式 */
.yjdg-card-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 20px;
    background: #fafbfc;
    text-align: center;
    min-height: 400px;
}

.yjdg-card-selector-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.7;
}

.yjdg-card-selector-title {
    font-size: 24px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.yjdg-card-selector-sub {
    font-size: 15px;
    color: #64748b;
    margin-bottom: 24px;
    max-width: 420px;
    line-height: 1.6;
}

.yjdg-card-selector-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 28px;
}

.yjdg-action-btn {
    padding: 10px 28px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.yjdg-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.yjdg-action-btn.yjdg-primary {
    background: #4f46e5;
    color: #fff;
    border-color: #4f46e5;
}

.yjdg-action-btn.yjdg-primary:hover {
    background: #4338ca;
    border-color: #4338ca;
}

.yjdg-action-btn.yjdg-secondary {
    background: #fff;
    color: #475569;
    border-color: #e2e8f0;
}

.yjdg-action-btn.yjdg-secondary:hover {
    background: #f8fafc;
}

.yjdg-card-selector-divider {
    width: 80px;
    height: 2px;
    background: #e2e8f0;
    margin-bottom: 20px;
}

.yjdg-card-selector-list {
    width: 100%;
    max-width: 480px;
    text-align: left;
}

.yjdg-list-label {
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    display: block;
    margin-bottom: 10px;
    padding-left: 2px;
}

.yjdg-card-item-mini {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #f1f5f9;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.yjdg-card-item-mini:hover {
    border-color: #cbd5e1;
    background: #fafbfc;
}

.yjdg-card-item-mini .info {
    flex: 1;
    min-width: 0;
}

.yjdg-card-item-mini .name {
    font-weight: 500;
    font-size: 14px;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.yjdg-card-item-mini .time {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 1px;
}

.yjdg-card-item-mini .load-mini-btn {
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    background: #eef2ff;
    color: #4f46e5;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
    margin-left: 10px;
}

.yjdg-card-item-mini .load-mini-btn:hover {
    background: #c7d2fe;
}

.empty-tip-sm {
    color: #94a3b8;
    font-size: 14px;
    padding: 20px 0;
    text-align: center;
}

/* 侧边栏新建卡片按钮 */
.yjdg-new-card-btn {
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    background: #4f46e5;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.yjdg-new-card-btn:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

/* 编辑器区域包装 */
.yjdg-editor-area-wrapper {
    display: none;
    flex-direction: column;
    height: 100%;
}

.yjdg-editor-area-wrapper.active {
    display: flex;
}

/* Toast */
.yjdg-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 28px;
    background: #1e293b;
    color: #f8fafc;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 999999;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    animation: yjdgToastIn 0.3s ease;
    max-width: 90%;
    text-align: center;
}

@keyframes yjdgToastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

















/* ============================================================================================= */
/* ============================================================
基础样式（与之前保持一致，仅保留必要部分）
============================================================ */
.external-toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    background: #fff;
    padding: 12px 24px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.external-toolbar button {
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    background: #eef2ff;
    color: #4f46e5;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.external-toolbar button:hover {
    background: #dbeafe;
}

#polish-window {
    display: none;
    position: fixed;
    top: 60px;
    left: 60px;
    width: 94vw;
    max-width: 1440px;
    height: 90vh;
    max-height: 920px;
    background: #f8fafc;
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    z-index: 999999;
    flex-direction: column;
    overflow: hidden;
    cursor: default;
}

#polish-window.open {
    display: flex;
}

#polish-window.fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    top: 0 !important;
    left: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.polish-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 18px 8px 20px;
    background: #ffffff;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    min-height: 54px;
    border-radius: 20px 20px 0 0;
    flex-wrap: wrap;
    gap: 6px;
    cursor: grab;
}

.polish-toolbar:active {
    cursor: grabbing;
}

.polish-toolbar .left-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.polish-toolbar .left-group .brand {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.polish-toolbar .left-group .brand i {
    color: #4f46e5;
}

.polish-toolbar .toolbar-btn {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.polish-toolbar .toolbar-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.polish-toolbar .toolbar-btn.active-btn {
    background: #eef2ff;
    color: #4f46e5;
}

.polish-toolbar .right-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.polish-toolbar .right-group .icon-btn {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.polish-toolbar .right-group .icon-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.polish-toolbar .right-group .icon-btn.primary-btn {
    background: #4f46e5;
    color: #fff;
}

.polish-toolbar .right-group .icon-btn.primary-btn:hover {
    background: #4338ca;
}

.polish-toolbar .right-group .icon-btn.danger-btn {
    color: #ef4444;
}

.polish-toolbar .right-group .icon-btn.danger-btn:hover {
    background: #fef2f2;
}

.polish-toolbar .right-group .icon-btn.close-btn {
    color: #ef4444;
}

.polish-toolbar .right-group .icon-btn.close-btn:hover {
    background: #fef2f2;
}

.polish-toolbar .right-group select {
    padding: 6px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    color: #1e293b;
    outline: none;
    cursor: pointer;
    transition: border 0.2s;
}

.polish-toolbar .right-group select:hover,
.polish-toolbar .right-group select:focus {
    border-color: #4f46e5;
}

/* ===== 主体布局 ===== */
.polish-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f8fafc;
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

/* ===== 左侧边栏（flex 子项） ===== */
.polish-left-sidebar {
    flex: 0 0 280px;
    width: 280px;
    background: #ffffff;
    border-right: 1px solid #eef2f7;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.06);
    transition: flex-basis 0.3s ease, width 0.3s ease, opacity 0.3s ease;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
}

.polish-left-sidebar.collapsed {
    flex: 0 0 0 !important;
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    border-right: none !important;
    overflow: hidden !important;
    opacity: 0;
    pointer-events: none;
}

.polish-left-sidebar .sidebar-header {
    padding: 12px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    font-weight: 600;
    color: #0f172a;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.polish-left-sidebar .sidebar-header i {
    color: #4f46e5;
}

.polish-left-sidebar .sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px 16px 16px;
}

.polish-left-sidebar .sidebar-body .form-group {
    margin-bottom: 14px;
}

.polish-left-sidebar .sidebar-body .form-group label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #1e293b;
    margin-bottom: 4px;
}

.polish-left-sidebar .sidebar-body .form-group input,
.polish-left-sidebar .sidebar-body .form-group textarea,
.polish-left-sidebar .sidebar-body .form-group select {
    width: 100%;
    padding: 6px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    background: #fafbfc;
    outline: none;
    transition: border 0.2s, background 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.polish-left-sidebar .sidebar-body .form-group input:focus,
.polish-left-sidebar .sidebar-body .form-group textarea:focus,
.polish-left-sidebar .sidebar-body .form-group select:focus {
    border-color: #4f46e5;
    background: #fff;
}

.polish-left-sidebar .sidebar-body .form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.polish-left-sidebar .sidebar-body .option-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.polish-left-sidebar .sidebar-body .option-tabs .opt-tab {
    padding: 4px 14px;
    border-radius: 20px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.polish-left-sidebar .sidebar-body .option-tabs .opt-tab:hover {
    border-color: #4f46e5;
    color: #4f46e5;
}

.polish-left-sidebar .sidebar-body .option-tabs .opt-tab.active-opt {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
}

/* 自定义指令下拉 */
.polish-left-sidebar .sidebar-body .saved-instr-area {
    margin-top: 4px;
    margin-bottom: 10px;
}

.polish-left-sidebar .sidebar-body .saved-instr-area select {
    width: 100%;
    padding: 6px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    background: #fafbfc;
    outline: none;
    cursor: pointer;
}

.polish-left-sidebar .sidebar-body .saved-instr-area select:focus {
    border-color: #4f46e5;
}

.polish-left-sidebar .sidebar-body .btn-save-instr {
    padding: 6px 20px;
    border-radius: 8px;
    border: none;
    background: #4f46e5;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.polish-left-sidebar .sidebar-body .btn-save-instr:hover {
    background: #4338ca;
}

.polish-left-sidebar .sidebar-body .instr-hint {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 6px;
}

.polish-left-sidebar .sidebar-body .current-opt-label {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

.polish-left-sidebar .sidebar-body .current-opt-label span {
    font-weight: 600;
    color: #4f46e5;
}

/* ===== 主内容区 ===== */
.polish-main-content {
    flex: 1;
    min-width: 0;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.polish-main-content .text-panes {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.text-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.text-pane .pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    min-height: 40px;
    flex-wrap: wrap;
    gap: 4px;
}

.text-pane .pane-header .pane-title {
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.text-pane .pane-header .pane-title .word-count {
    font-weight: 400;
    font-size: 12px;
    color: #94a3b8;
    background: #f1f5f9;
    padding: 0 10px;
    border-radius: 12px;
}

.text-pane .pane-header .pane-actions {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: wrap;
}

.text-pane .pane-header .pane-actions button {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 2px 10px;
    font-size: 14px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.text-pane .pane-header .pane-actions button:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.text-pane .pane-header .pane-actions button.primary-action {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
}

.text-pane .pane-header .pane-actions button.primary-action:hover {
    background: #4338ca;
    border-color: #4338ca;
}

.text-pane .pane-body {
    flex: 1;
    padding: 10px 14px;
    overflow-y: auto;
    background: #ffffff;
}

.text-pane .pane-body textarea {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    resize: none;
    font-size: 15px;
    line-height: 1.7;
    color: #0f172a;
    background: transparent;
    font-family: inherit;
    min-height: 120px;
}

.text-pane .pane-body textarea::placeholder {
    color: #cbd5e1;
}

.divider-handle {
    width: 6px;
    background: #e2e8f0;
    cursor: col-resize;
    flex-shrink: 0;
    transition: background 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.divider-handle:hover,
.divider-handle.active {
    background: #4f46e5;
}

.divider-handle::after {
    content: '⋮';
    color: #94a3b8;
    font-size: 16px;
    font-weight: 700;
    transition: color 0.2s;
}

.divider-handle:hover::after {
    color: #fff;
}

/* ===== 右侧浮动边栏 ===== */
.polish-right-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: 360px;
    background: #ffffff;
    border-left: 1px solid #eef2f7;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateX(0);
    opacity: 1;
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.08);
}

.polish-right-sidebar.collapsed {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

.polish-right-sidebar .sidebar-header {
    padding: 10px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.polish-right-sidebar .sidebar-header .h-title {
    font-weight: 600;
    color: #0f172a;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.polish-right-sidebar .sidebar-header .h-actions {
    display: flex;
    gap: 6px;
}

.polish-right-sidebar .sidebar-header .h-actions button {
    background: transparent;
    border: none;
    font-size: 13px;
    color: #64748b;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.polish-right-sidebar .sidebar-header .h-actions button:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.polish-right-sidebar .sidebar-header .h-actions button.danger:hover {
    color: #ef4444;
    background: #fef2f2;
}

.polish-right-sidebar .sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
}

.polish-right-sidebar .sidebar-body .history-item {
    background: #f8fafc;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid #eef2f7;
    transition: border 0.2s;
}

.polish-right-sidebar .sidebar-body .history-item:hover {
    border-color: #cbd5e1;
}

.polish-right-sidebar .sidebar-body .history-item .h-text {
    font-size: 13px;
    color: #475569;
    margin-bottom: 4px;
    line-height: 1.5;
    word-break: break-all;
}

.polish-right-sidebar .sidebar-body .history-item .h-text strong {
    color: #0f172a;
}

.polish-right-sidebar .sidebar-body .history-item .h-result {
    font-size: 13px;
    color: #1e293b;
    background: #eef2ff;
    padding: 6px 10px;
    border-radius: 6px;
    margin-top: 4px;
    line-height: 1.5;
    word-break: break-all;
}

.polish-right-sidebar .sidebar-body .history-item .h-time {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
    text-align: right;
}

.polish-right-sidebar .sidebar-body .history-item .h-actions-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
}

.polish-right-sidebar .sidebar-body .history-item .h-actions-row button {
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 2px 12px;
    font-size: 12px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.polish-right-sidebar .sidebar-body .history-item .h-actions-row button:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.polish-right-sidebar .sidebar-body .history-item .h-actions-row button.load-btn:hover {
    background: #eef2ff;
    border-color: #4f46e5;
    color: #4f46e5;
}

.polish-right-sidebar .sidebar-body .history-item .h-actions-row button.delete-btn:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #ef4444;
}

.polish-right-sidebar .sidebar-body .empty-history {
    color: #94a3b8;
    text-align: center;
    padding: 30px 0;
    font-size: 14px;
}

/* ===== 底部 ===== */
.polish-footer {
    flex-shrink: 0;
    padding: 6px 20px;
    background: #ffffff;
    border-top: 1px solid #eef2f7;
    border-radius: 0 0 20px 20px;
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.polish-footer .footer-icon {
    color: #4f46e5;
    font-size: 14px;
    flex-shrink: 0;
}

.polish-footer .footer-message {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* ===== Toast ===== */
.toast-polish {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    padding: 10px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 9999999;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.toast-polish.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

@media (max-width: 900px) {
    .polish-left-sidebar {
        flex: 0 0 220px !important;
        width: 220px !important;
    }

    .polish-left-sidebar.collapsed {
        flex: 0 0 0 !important;
        width: 0 !important;
    }

    .polish-right-sidebar {
        width: 280px;
    }

    #polish-window {
        width: 98vw;
        height: 95vh;
        max-height: none;
    }
}

@media (max-width: 700px) {
    .polish-left-sidebar {
        flex: 0 0 180px !important;
        width: 180px !important;
    }

    .polish-left-sidebar.collapsed {
        flex: 0 0 0 !important;
        width: 0 !important;
    }

    .polish-right-sidebar {
        width: 220px;
    }

    .polish-toolbar .left-group .brand {
        font-size: 15px;
    }

    .polish-toolbar .toolbar-btn {
        font-size: 12px;
        padding: 4px 8px;
    }

    .text-pane .pane-header .pane-title {
        font-size: 12px;
    }

    .text-pane .pane-body textarea {
        font-size: 13px;
    }
}















/* ============================================================================================= */
/* ===== 全局重置 & 基础 ===== */
* {
    box-sizing: border-box;
}

/* ===== 地图窗口 ===== */
#map_window {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    height: 92%;
    max-width: 1600px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    z-index: 10002;
    overflow: hidden;
    border-radius: 12px;
}

#map_window.active {
    display: flex;
}

#map_window.fullscreen-mode {
    transform: none !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
}

/* ===== 顶部工具栏 ===== */
#map-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #e9edf4;
    min-height: 52px;
    flex-shrink: 0;
    flex-wrap: wrap;
    z-index: 100;
    position: relative;
}

#map-toolbar .toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#map-toolbar .toolbar-center {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 auto;
    flex-wrap: wrap;
    justify-content: center;
}

#map-toolbar .toolbar-right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* ===== 统一按钮样式 ===== */
.toolbar-btn,
.sidebar-toggle-btn,
.btn-sm {
    height: 34px;
    padding: 0 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    border: none;
    line-height: 1;
    background: #f1f5f9;
    color: #1e293b;
    flex-shrink: 0;
    min-width: 36px;
    font-family: inherit;
    text-decoration: none;
}

.toolbar-btn .icon,
.sidebar-toggle-btn .icon {
    font-size: 15px;
    line-height: 1;
    flex-shrink: 0;
}

.toolbar-btn .btn-label,
.sidebar-toggle-btn .btn-label {
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
}

/* 悬停 & 激活 */
.toolbar-btn:hover,
.sidebar-toggle-btn:hover,
.btn-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.toolbar-btn:active,
.sidebar-toggle-btn:active,
.btn-sm:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ---- 颜色变体（简洁统一） ---- */
/* 主要操作：蓝色 */
.toolbar-btn.primary,
.btn-sm.primary {
    background: #4f46e5;
    color: #ffffff;
}

.toolbar-btn.primary:hover,
.btn-sm.primary:hover {
    background: #4338ca;
}

/* 成功操作：绿色 */
.toolbar-btn.success,
.btn-sm.success {
    background: #16a34a;
    color: #ffffff;
}

.toolbar-btn.success:hover,
.btn-sm.success:hover {
    background: #15803d;
}

/* 危险操作：红色 */
.toolbar-btn.danger,
.btn-sm.danger {
    background: #dc2626;
    color: #ffffff;
}

.toolbar-btn.danger:hover,
.btn-sm.danger:hover {
    background: #b91c1c;
}

/* 警告操作：橙色（仅保存地标） */
.toolbar-btn.warning,
.btn-sm.warning {
    background: #f59e0b;
    color: #ffffff;
}

.toolbar-btn.warning:hover,
.btn-sm.warning:hover {
    background: #d97706;
}

/* 普通操作：灰色（默认） */
.toolbar-btn.outline,
.btn-sm.outline {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #dce2ec;
}

.toolbar-btn.outline:hover,
.btn-sm.outline:hover {
    background: #e2e8f0;
    border-color: #c8d0dc;
}

/* 侧边栏切换按钮（设置/历史） */
.sidebar-toggle-btn {
    background: #f1f5f9;
    border: 1px solid #dce2ec;
    color: #1e293b;
}

.sidebar-toggle-btn:hover {
    background: #e2e8f0;
    border-color: #c8d0dc;
}

.sidebar-toggle-btn.active {
    background: #eef2ff;
    border-color: #4f46e5;
    color: #4f46e5;
}

/* 工具栏分割线 */
.toolbar-divider {
    width: 1px;
    height: 28px;
    background: #dce2ec;
    margin: 0 4px;
    flex-shrink: 0;
}

/* 标题 */
.toolbar-title {
    font-weight: 600;
    font-size: 15px;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.toolbar-title .badge {
    font-size: 10px;
    background: #eef2ff;
    color: #4f46e5;
    padding: 0 10px;
    border-radius: 10px;
    font-weight: 500;
}

/* 状态文字 */
#mapStatus {
    font-size: 12px;
    color: #64748b;
    margin-right: 6px;
    white-space: nowrap;
    min-width: 60px;
}

/* ===== 主体 ===== */
#map-body {
    flex: 1;
    position: relative;
    overflow: auto;
    background: #f0f2f5;
    padding-bottom: 70px;
}

/* ===== 主内容区 ===== */
#map-main-content {
    width: 100%;
    height: auto;
    background: #f0f2f5;
    padding: 12px;
    overflow: visible;
}

#map-main-content .map-wrapper {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    padding: 16px;
    display: inline-block;
    min-width: 100%;
    transform-origin: top left;
}

/* ===== 地图表格 ===== */
#map-main-content .map-wrapper table {
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 11px;
    width: auto;
    margin: 0 auto;
    min-width: 1800px;
}

#map-main-content .map-wrapper table th,
#map-main-content .map-wrapper table td {
    border: 1px solid #aaa;
    padding: 0;
    margin: 0;
    text-align: center;
    vertical-align: middle;
    width: 60px;
    min-width: 60px;
    max-width: 60px;
    height: 24px;
}

#map-main-content .map-wrapper table th {
    background: #2c3e50 !important;
    color: #ffffff !important;
    font-weight: 700;
    font-size: 10px;
    padding: 0 2px;
    border-color: #2c3e50;
}

#map-main-content .map-wrapper table thead tr:first-child th {
    background: #1a2634 !important;
    color: #f1f5f9 !important;
    font-size: 12px;
    padding: 4px 2px;
}

#map-main-content .map-wrapper table thead tr:nth-child(2) th {
    background: #34495e !important;
    color: #ecf0f1 !important;
}

#map-main-content .map-wrapper table tbody td:first-child {
    background: #f3f4f6;
    font-weight: 600;
    font-size: 10px;
    color: #1e293b;
}

#map-main-content .map-wrapper table tbody td:last-child {
    background: #fef9e3;
    font-weight: 600;
    font-size: 10px;
    color: #1e293b;
}

#map-main-content .map-wrapper table td input {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    padding: 0 2px;
    text-align: center;
    background: transparent;
    font-size: 11px;
    box-sizing: border-box;
    font-family: inherit;
    color: #1e293b;
}

#map-main-content .map-wrapper table td input:focus {
    background: #fef9c3;
}

#map-main-content .map-wrapper table tfoot td,
#map-main-content .map-wrapper table tfoot th {
    background: #2c3e50 !important;
    color: #ffffff !important;
    font-weight: 700;
    padding: 4px 2px;
}

/* ===== 左侧面板 ===== */
#map-left-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    overflow: hidden;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(248, 250, 252, 0.97);
    backdrop-filter: blur(12px);
    border-right: 1px solid #eef2f7;
    z-index: 50;
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.06);
}

#map-left-panel.open {
    width: 520px;
}

#map-left-panel .panel-inner {
    width: 520px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#map-left-panel.open .panel-inner {
    transform: translateX(0);
}

.panel-header {
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header .close-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #94a3b8;
    padding: 0 4px;
}

.panel-header .close-btn:hover {
    color: #475569;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px 20px;
}

.setting-group {
    background: #fff;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border: 1px solid #f1f5f9;
}

.setting-group .group-title {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.setting-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 6px;
}

.setting-row label {
    font-size: 12px;
    color: #475569;
    min-width: 44px;
}

.setting-row select,
.setting-row input[type="text"] {
    padding: 4px 6px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 12px;
    background: #fff;
    color: #1e293b;
    outline: none;
    height: 30px;
    transition: border-color 0.2s;
    flex: 1;
    min-width: 60px;
}

.setting-row select:focus,
.setting-row input[type="text"]:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.06);
}

.setting-row select {
    min-width: 70px;
    cursor: pointer;
}

.btn-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.btn-group .btn-sm {
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: 6px;
}

.landmark-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 3px;
    margin-top: 6px;
}

.landmark-grid input {
    width: 100%;
    padding: 2px 2px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 10px;
    text-align: center;
    background: #fafbfc;
    outline: none;
    height: 28px;
    transition: border-color 0.2s;
}

.landmark-grid input:focus {
    border-color: #4f46e5;
    background: #fff;
}

.landmark-grid input::placeholder {
    color: #cbd5e1;
    font-size: 9px;
}

/* ===== 右侧面板 ===== */
#map-right-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 0;
    height: 100%;
    overflow: hidden;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(248, 250, 252, 0.97);
    backdrop-filter: blur(12px);
    border-left: 1px solid #eef2f7;
    z-index: 50;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.06);
}

#map-right-panel.open {
    width: 320px;
}

#map-right-panel .panel-inner {
    width: 320px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#map-right-panel.open .panel-inner {
    transform: translateX(0);
}

.history-item {
    background: #fff;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    border: 1px solid #f1f5f9;
    cursor: pointer;
    transition: border-color 0.2s;
}

.history-item:hover {
    border-color: #d1d5db;
}

.history-item .item-time {
    font-size: 11px;
    color: #94a3b8;
}

.history-item .item-name {
    font-weight: 600;
    font-size: 13px;
    color: #0f172a;
    margin: 2px 0;
}

.history-item .item-meta {
    font-size: 11px;
    color: #94a3b8;
}

.history-item .item-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.history-item .item-actions button {
    padding: 2px 12px;
    border-radius: 4px;
    font-size: 11px;
    border: none;
    cursor: pointer;
    height: 26px;
    font-weight: 500;
}

.history-item .item-actions .btn-load {
    background: #eef2ff;
    color: #4f46e5;
}

.history-item .item-actions .btn-load:hover {
    background: #c7d2fe;
}

.history-item .item-actions .btn-delete {
    background: #fee2e2;
    color: #ef4444;
}

.history-item .item-actions .btn-delete:hover {
    background: #fecaca;
}

.history-empty {
    text-align: center;
    color: #94a3b8;
    padding: 40px 20px;
    font-size: 14px;
}

.history-empty .icon {
    font-size: 32px;
    display: block;
    margin-bottom: 12px;
}

/* ===== 缩放控件 ===== */
#map_window .map-zoom-controls {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10010;
    display: inline-flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    padding: 4px 14px;
    border-radius: 30px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(200, 200, 200, 0.3);
    font-size: 13px;
    white-space: nowrap;
    pointer-events: auto;
}

#map_window .map-zoom-controls button {
    background: #f1f5f9;
    border: none;
    border-radius: 6px;
    padding: 0 12px;
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
    height: 28px;
    display: inline-flex;
    align-items: center;
    color: #1e293b;
    min-width: 32px;
    justify-content: center;
}

#map_window .map-zoom-controls button:hover {
    background: #e2e8f0;
}

#map_window .map-zoom-controls .zoom-level {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    min-width: 46px;
    text-align: center;
    line-height: 28px;
}

/* ===== 滚动条美化 ===== */
.panel-body::-webkit-scrollbar,
#map-body::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.panel-body::-webkit-scrollbar-track,
#map-body::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 4px;
}

.panel-body::-webkit-scrollbar-thumb,
#map-body::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

.panel-body::-webkit-scrollbar-thumb:hover,
#map-body::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* ================================================================ */
/* 响应式设计 */
/* ================================================================ */

@media (max-width: 1024px) {
    #map-left-panel.open {
        width: 440px;
    }

    #map-left-panel .panel-inner {
        width: 440px;
    }

    #map-right-panel.open {
        width: 280px;
    }

    #map-right-panel .panel-inner {
        width: 280px;
    }

    .toolbar-btn,
    .sidebar-toggle-btn {
        height: 30px;
        padding: 0 10px;
        font-size: 12px;
    }

    .toolbar-btn .icon,
    .sidebar-toggle-btn .icon {
        font-size: 13px;
    }

    .toolbar-btn .btn-label,
    .sidebar-toggle-btn .btn-label {
        font-size: 12px;
    }

    #map-main-content .map-wrapper table {
        font-size: 10px;
        min-width: 1500px;
    }

    #map-main-content .map-wrapper table th,
    #map-main-content .map-wrapper table td {
        width: 50px;
        min-width: 50px;
        max-width: 50px;
        height: 22px;
    }

    #map-main-content .map-wrapper table td input {
        font-size: 10px;
    }
}

@media (max-width: 768px) {
    #map_window {
        width: 98%;
        height: 96%;
        border-radius: 8px;
    }

    #map-toolbar {
        padding: 4px 8px;
        min-height: 44px;
        gap: 4px;
    }

    #map-toolbar .toolbar-center {
        order: 3;
        flex-basis: 100%;
        justify-content: flex-start;
        gap: 3px;
        padding-top: 4px;
    }

    .toolbar-btn,
    .sidebar-toggle-btn {
        height: 28px;
        padding: 0 8px;
        font-size: 11px;
        min-width: 28px;
    }

    .toolbar-btn .icon,
    .sidebar-toggle-btn .icon {
        font-size: 13px;
    }

    /* 窄屏隐藏按钮文字，只显示图标 */
    .toolbar-btn .btn-label,
    .sidebar-toggle-btn .btn-label {
        display: none;
    }

    .toolbar-title {
        font-size: 13px;
    }

    .toolbar-title .badge {
        display: none;
    }

    #mapStatus {
        font-size: 10px;
        min-width: 40px;
    }

    #map-left-panel.open {
        width: 360px;
    }

    #map-left-panel .panel-inner {
        width: 360px;
    }

    #map-right-panel.open {
        width: 240px;
    }

    #map-right-panel .panel-inner {
        width: 240px;
    }

    #map-main-content .map-wrapper table {
        font-size: 9px;
        min-width: 1200px;
    }

    #map-main-content .map-wrapper table th,
    #map-main-content .map-wrapper table td {
        width: 40px;
        min-width: 40px;
        max-width: 40px;
        height: 20px;
    }

    #map-main-content .map-wrapper table td input {
        font-size: 9px;
    }

    .landmark-grid {
        grid-template-columns: repeat(8, 1fr);
    }

    #map_window .map-zoom-controls {
        padding: 2px 10px;
        bottom: 8px;
        gap: 4px;
    }

    #map_window .map-zoom-controls button {
        font-size: 12px;
        padding: 0 8px;
        height: 24px;
        min-width: 28px;
    }

    #map_window .map-zoom-controls .zoom-level {
        font-size: 11px;
        min-width: 36px;
        line-height: 24px;
    }

    .btn-sm {
        height: 26px !important;
        padding: 0 8px !important;
        font-size: 11px !important;
    }
}

@media (max-width: 480px) {
    #map-left-panel.open {
        width: 280px;
    }

    #map-left-panel .panel-inner {
        width: 280px;
    }

    #map-right-panel.open {
        width: 200px;
    }

    #map-right-panel .panel-inner {
        width: 200px;
    }

    .toolbar-btn,
    .sidebar-toggle-btn {
        height: 24px;
        padding: 0 5px;
        font-size: 10px;
        min-width: 24px;
        gap: 3px;
    }

    .toolbar-btn .icon,
    .sidebar-toggle-btn .icon {
        font-size: 11px;
    }

    .toolbar-divider {
        margin: 0 2px;
        height: 20px;
    }

    #mapStatus {
        font-size: 9px;
        min-width: 30px;
    }

    #map-main-content .map-wrapper table {
        font-size: 8px;
        min-width: 900px;
    }

    #map-main-content .map-wrapper table th,
    #map-main-content .map-wrapper table td {
        width: 30px;
        min-width: 30px;
        max-width: 30px;
        height: 18px;
    }

    #map-main-content .map-wrapper table td input {
        font-size: 8px;
    }

    .landmark-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    #map_window .map-zoom-controls {
        padding: 2px 6px;
        bottom: 6px;
        gap: 3px;
    }

    #map_window .map-zoom-controls button {
        font-size: 10px;
        padding: 0 6px;
        height: 22px;
        min-width: 24px;
    }

    #map_window .map-zoom-controls .zoom-level {
        font-size: 10px;
        min-width: 30px;
        line-height: 22px;
    }
}

















/* ============================================================================================= */
/* ============================================================
   按钮通用
   ============================================================ */
.btn-bai {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 13px;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-bai:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.btn-dark {
    background: #1e293b;
    border: 1px solid #1e293b;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 13px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-dark:hover {
    background: #0f172a;
}

.imitation-btn8 {
    background: transparent;
    border: none;
    padding: 4px 8px;
    font-size: 16px;
    color: #475569;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.imitation-btn8:hover {
    background: #eef2ff;
    color: #4f46e5;
}

.imitation-btn6 {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 12px;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
}

.imitation-btn6:hover {
    background: #f1f5f9;
}

.imitation-btn1 {
    background: #4f46e5;
    border: none;
    border-radius: 6px;
    padding: 4px 14px;
    font-size: 12px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.imitation-btn1:hover {
    background: #4338ca;
}

.imitation-btn9 {
    background: #059669;
    border: none;
    border-radius: 6px;
    padding: 4px 14px;
    font-size: 12px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.imitation-btn9:hover {
    background: #047857;
}

.writing-btn {
    background: transparent !important;
    border: none !important;
    font-size: 13px;
    color: #64748b;
    cursor: default;
}

/* ============================================================
   主容器 - 原创写作区
   ============================================================ */
#original-editor-overlay {
    display: none;
    /* 默认隐藏 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.30);
    backdrop-filter: blur(3px);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    animation: ori-fadeIn 0.25s ease;
}

@keyframes ori-fadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.ori-editor-container {
    position: relative;
    width: 94vw;
    max-width: 1480px;
    height: 92vh;
    max-height: 920px;
    background: #f8fafc;
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: all 0.2s ease;
    user-select: none;
}

/* ============================================================
   顶部栏
   ============================================================ */
.ori-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 20px;
    background: #ffffff;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    min-height: 52px;
    border-radius: 20px 20px 0 0;
    flex-wrap: wrap;
    gap: 6px;
}

.ori-toolbar .ori-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ori-toolbar .ori-title i {
    color: #4f46e5;
}

.ori-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
}

.ori-toolbar-actions button {
    background: transparent;
    border: none;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.ori-toolbar-actions button:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.ori-toolbar-actions .ori-save-btn {
    background: #4f46e5;
    color: #fff;
    padding: 5px 18px;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
    font-weight: 600;
}

.ori-toolbar-actions .ori-save-btn:hover {
    background: #4338ca;
    box-shadow: 0 6px 24px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.ori-toolbar-actions .ori-close-btn {
    color: #ef4444;
}

.ori-toolbar-actions .ori-close-btn:hover {
    background: #fef2f2;
}

/* ============================================================
   主体 (flex)
   ============================================================ */
.ori-body {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
    padding: 10px 14px 14px 14px;
    gap: 0;
    background: #f8fafc;
}

/* ============================================================
   左侧边栏 (原创设置)
   ============================================================ */
.ori-left-sidebar {
    position: absolute;
    top: 10px;
    left: 10px;
    bottom: 10px;
    width: 260px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #eef2f7;
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    transform: translateX(calc(-100% - 30px));
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    z-index: 5;
    overflow: hidden;
    padding: 0;
    box-sizing: border-box;
    pointer-events: none;
}

.ori-left-sidebar.ori-sidebar-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.ori-left-sidebar .ori-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
}

.ori-left-sidebar .ori-sidebar-header span {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

.ori-left-sidebar .ori-sidebar-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
}

.ori-left-sidebar .ori-sidebar-close:hover {
    color: #ef4444;
}

.ori-left-sidebar .ori-sidebar-body {
    flex: 1;
    padding: 14px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ori-left-sidebar .ori-sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ori-left-sidebar .ori-sidebar-section label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.ori-left-sidebar .ori-sidebar-section button,
.ori-left-sidebar .ori-sidebar-section select {
    padding: 7px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #fafbfc;
    font-size: 13px;
    color: #0f172a;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.ori-left-sidebar .ori-sidebar-section button:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.ori-left-sidebar .ori-sidebar-hint {
    font-size: 12px;
    color: #94a3b8;
    padding: 2px 0;
}

/* ============================================================
   右侧边栏 - 已有卡片 (原历史记录)
   ============================================================ */
.ori-history-sidebar {
    position: absolute;
    top: 10px;
    right: 10px;
    bottom: 10px;
    width: 400px;
    max-width: 52vw;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #eef2f7;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    transform: translateX(calc(100% + 30px));
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    z-index: 15;
    overflow: hidden;
    padding: 0;
    box-sizing: border-box;
    pointer-events: none;
}

.ori-history-sidebar.ori-history-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.ori-history-sidebar .ori-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
}

.ori-history-sidebar .ori-sidebar-header span {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ori-history-sidebar .ori-sidebar-header span .card-count {
    font-size: 12px;
    font-weight: 400;
    color: #94a3b8;
    margin-left: 4px;
}

.ori-history-sidebar .ori-sidebar-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
}

.ori-history-sidebar .ori-sidebar-close:hover {
    color: #ef4444;
}

.ori-history-sidebar .ori-sidebar-body {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
    background: #ffffff;
}

/* 卡片列表项 */
.ori-history-sidebar .ori-sidebar-body .ori-card-item {
    padding: 10px 12px;
    border-bottom: 1px solid #eef2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 6px;
}

.ori-history-sidebar .ori-sidebar-body .ori-card-item:hover {
    background: #f8fafc;
}

.ori-history-sidebar .ori-sidebar-body .ori-card-item:last-child {
    border-bottom: none;
}

.ori-history-sidebar .ori-sidebar-body .ori-card-item .info {
    flex: 1;
    min-width: 0;
}

.ori-history-sidebar .ori-sidebar-body .ori-card-item .info .name {
    font-weight: 500;
    font-size: 14px;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ori-history-sidebar .ori-sidebar-body .ori-card-item .info .time {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 2px;
}

.ori-history-sidebar .ori-sidebar-body .ori-card-item .actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 12px;
}

.ori-history-sidebar .ori-sidebar-body .ori-card-item .actions button {
    padding: 4px 12px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.ori-history-sidebar .ori-sidebar-body .ori-card-item .actions .load-btn {
    background: #4f46e5;
    color: #fff;
}

.ori-history-sidebar .ori-sidebar-body .ori-card-item .actions .load-btn:hover {
    background: #4338ca;
}

.ori-history-sidebar .ori-sidebar-body .ori-card-item .actions .del-btn {
    background: #ef4444;
    color: #fff;
}

.ori-history-sidebar .ori-sidebar-body .ori-card-item .actions .del-btn:hover {
    background: #dc2626;
}

.ori-history-sidebar .ori-sidebar-body .empty-tip {
    color: #94a3b8;
    text-align: center;
    padding: 40px 0;
    font-size: 14px;
}

/* 卡片选择界面中的卡片列表（紧凑） */
.ori-card-selector-list .ori-card-item-mini {
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: 4px;
}

.ori-card-selector-list .ori-card-item-mini:hover {
    background: #f8fafc;
}

.ori-card-selector-list .ori-card-item-mini .info .name {
    font-weight: 500;
    font-size: 13px;
    color: #0f172a;
}

.ori-card-selector-list .ori-card-item-mini .info .time {
    font-size: 11px;
    color: #94a3b8;
}

.ori-card-selector-list .ori-card-item-mini .load-mini-btn {
    padding: 3px 12px;
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.ori-card-selector-list .ori-card-item-mini .load-mini-btn:hover {
    background: #4338ca;
}

/* ============================================================
   主编辑器
   ============================================================ */
.ori-main-editor {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #eef2f7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    position: relative;
    z-index: 1;
    margin-left: 0;
    margin-right: 0;
    transition: margin 0.3s ease;
}

.ori-main-editor.ori-with-left {
    margin-left: 280px;
}

.ori-main-editor.ori-with-right {
    margin-right: 420px;
}

.ori-main-editor.ori-with-left.ori-with-right {
    margin-left: 280px;
    margin-right: 420px;
}

/* 主标签栏 */
.ori-main-tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 16px 0 16px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.ori-main-tabs .ori-tab-btn {
    padding: 8px 18px;
    border: none;
    background: transparent;
    border-radius: 8px 8px 0 0;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.ori-main-tabs .ori-tab-btn:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.ori-main-tabs .ori-tab-btn.active {
    color: #4f46e5;
    background: #ffffff;
    border-bottom-color: #4f46e5;
    font-weight: 600;
}

/* 副标签容器 (右侧) */
.ori-side-tabs-container {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding-left: 12px;
    border-left: 2px solid #e2e8f0;
    flex-wrap: wrap;
}

.ori-side-tabs-container .ori-side-tab-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

.ori-side-tabs-container .ori-side-tab-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.ori-side-tabs-container .ori-side-tab-btn.ori-active {
    background: #eef2ff;
    color: #4f46e5;
    border-color: #c7d2fe;
    font-weight: 600;
}

.ori-side-tabs-container .ori-side-tab-btn.ori-background-btn {
    color: #8b5cf6;
}

.ori-side-tabs-container .ori-side-tab-btn.ori-background-btn.ori-active {
    background: #ede9fe;
    border-color: #a78bfa;
}

/* 编辑器工具栏 */
.ori-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
    flex-wrap: wrap;
    min-height: 38px;
}

.ori-editor-toolbar button {
    background: transparent;
    border: none;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.ori-editor-toolbar button:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.ori-editor-toolbar .ori-side-close-btn {
    margin-left: auto;
    color: #94a3b8;
    font-size: 16px;
    padding: 0 8px;
}

.ori-editor-toolbar .ori-side-close-btn:hover {
    background: #fef2f2;
    color: #ef4444;
}

/* ============================================================
   卡片选择界面 (主内容区默认显示)
   ============================================================ */
.ori-card-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 30px 20px;
    text-align: center;
    background: #ffffff;
    gap: 24px;
}

.ori-card-selector .ori-card-selector-icon {
    font-size: 56px;
    color: #4f46e5;
    opacity: 0.8;
}

.ori-card-selector .ori-card-selector-title {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.ori-card-selector .ori-card-selector-sub {
    font-size: 14px;
    color: #64748b;
    max-width: 400px;
    margin: 0 auto;
}

.ori-card-selector .ori-card-selector-actions {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 8px;
}

.ori-card-selector .ori-card-selector-actions .ori-action-btn {
    padding: 12px 32px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ori-card-selector .ori-card-selector-actions .ori-action-btn.ori-primary {
    background: #4f46e5;
    color: #fff;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.30);
}

.ori-card-selector .ori-card-selector-actions .ori-action-btn.ori-primary:hover {
    background: #4338ca;
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(79, 70, 229, 0.40);
}

.ori-card-selector .ori-card-selector-actions .ori-action-btn.ori-secondary {
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

.ori-card-selector .ori-card-selector-actions .ori-action-btn.ori-secondary:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.ori-card-selector .ori-card-selector-divider {
    width: 60px;
    height: 2px;
    background: #e2e8f0;
    border-radius: 2px;
    margin: 4px 0;
}

.ori-card-selector .ori-card-selector-list {
    width: 100%;
    max-width: 500px;
    max-height: 200px;
    overflow-y: auto;
    text-align: left;
    border-top: 1px solid #f1f5f9;
    padding-top: 16px;
    margin-top: 4px;
}

.ori-card-selector .ori-card-selector-list .ori-list-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
    display: block;
}

.ori-card-selector .ori-card-selector-list .empty-tip-sm {
    color: #94a3b8;
    font-size: 13px;
    padding: 12px 0;
    text-align: center;
}

/* ============================================================
   主内容区 (编辑区域)
   ============================================================ */
.ori-main-content {
    flex: 1;
    padding: 12px 16px;
    overflow: auto;
    background: #ffffff;
    min-height: 0;
    position: relative;
}

.ori-main-content .ori-editor-wrapper {
    display: none;
    flex-direction: column;
    height: 100%;
}

.ori-main-content .ori-editor-wrapper.active {
    display: flex;
}

.ori-main-content textarea,
.ori-main-content input[type="text"] {
    width: 100%;
    border: 1.5px solid #eef2f7;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.7;
    resize: none;
    outline: none;
    background: #fafbfc;
    transition: border 0.2s;
    box-sizing: border-box;
    color: #0f172a;
}

.ori-main-content textarea:focus,
.ori-main-content input[type="text"]:focus {
    border-color: #4f46e5;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.05);
}

.ori-main-content .ori-write-area {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ori-main-content .ori-write-area .ori-chapter-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.ori-main-content .ori-write-area .ori-chapter-row input {
    flex: 1;
    padding: 6px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
    background: #fafbfc;
    outline: none;
    min-width: 150px;
}

.ori-main-content .ori-write-area .ori-chapter-row input:focus {
    border-color: #4f46e5;
}

.ori-main-content .ori-write-area .ori-write-textarea {
    flex: 1;
    min-height: 200px;
    border: 1.5px solid #eef2f7;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.8;
    resize: none;
    outline: none;
    background: #fafbfc;
    transition: border 0.2s;
}

.ori-main-content .ori-write-area .ori-write-textarea:focus {
    border-color: #4f46e5;
    background: #ffffff;
}

/* 大纲和细纲 */
.ori-main-content .ori-outline-area,
.ori-main-content .ori-detail-area {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ori-main-content .ori-outline-area textarea,
.ori-main-content .ori-detail-area textarea {
    flex: 1;
    min-height: 200px;
    border: 1.5px solid #eef2f7;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.8;
    resize: none;
    outline: none;
    background: #fafbfc;
    transition: border 0.2s;
}

.ori-main-content .ori-outline-area textarea:focus,
.ori-main-content .ori-detail-area textarea:focus {
    border-color: #4f46e5;
    background: #ffffff;
}

/* 字数统计底部 */
.ori-word-count-bottom {
    padding: 4px 16px;
    border-top: 1px solid #eef2f7;
    background: #fafbfc;
    text-align: right;
    font-size: 13px;
    color: #64748b;
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ori-word-count-bottom button {
    background: transparent;
    border: none;
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.ori-word-count-bottom button:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* ============================================================
   副编辑器 (浮动面板)
   ============================================================ */
.ori-side-editor {
    position: absolute;
    top: 56px;
    right: 10px;
    bottom: 16px;
    width: 420px;
    max-width: 52vw;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #eef2f7;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.08), 0 4px 24px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    transform: translateX(calc(100% + 30px));
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    z-index: 10;
    overflow: hidden;
    padding: 0;
    box-sizing: border-box;
    pointer-events: none;
}

.ori-side-editor.ori-side-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.ori-side-editor .ori-side-content {
    flex: 1;
    padding: 12px 16px;
    overflow: auto;
    background: #ffffff;
}

.ori-side-editor .ori-side-content textarea {
    width: 100%;
    height: 100%;
    border: 1.5px solid #eef2f7;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.7;
    resize: none;
    outline: none;
    background: #fafbfc;
    transition: border 0.2s;
    box-sizing: border-box;
    color: #0f172a;
}

.ori-side-editor .ori-side-content textarea:focus {
    border-color: #4f46e5;
    background: #ffffff;
}

.ori-side-editor .ori-side-content .ori-write-area {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ori-side-editor .ori-side-content .ori-write-area .ori-chapter-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.ori-side-editor .ori-side-content .ori-write-area .ori-chapter-row input {
    flex: 1;
    padding: 6px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
    background: #fafbfc;
    outline: none;
}

.ori-side-editor .ori-side-content .ori-write-area .ori-chapter-row input:focus {
    border-color: #4f46e5;
}

.ori-side-editor .ori-side-content .ori-write-area .ori-write-textarea {
    flex: 1;
    min-height: 150px;
    border: 1.5px solid #eef2f7;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.8;
    resize: none;
    outline: none;
    background: #fafbfc;
    transition: border 0.2s;
}

.ori-side-editor .ori-side-content .ori-write-area .ori-write-textarea:focus {
    border-color: #4f46e5;
    background: #ffffff;
}

/* ============================================================
   滚动条
   ============================================================ */
.ori-main-content::-webkit-scrollbar,
.ori-side-content::-webkit-scrollbar,
.ori-left-sidebar .ori-sidebar-body::-webkit-scrollbar,
.ori-history-sidebar .ori-sidebar-body::-webkit-scrollbar,
.ori-card-selector-list::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.ori-main-content::-webkit-scrollbar-track,
.ori-side-content::-webkit-scrollbar-track,
.ori-left-sidebar .ori-sidebar-body::-webkit-scrollbar-track,
.ori-history-sidebar .ori-sidebar-body::-webkit-scrollbar-track,
.ori-card-selector-list::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 8px;
}

.ori-main-content::-webkit-scrollbar-thumb,
.ori-side-content::-webkit-scrollbar-thumb,
.ori-left-sidebar .ori-sidebar-body::-webkit-scrollbar-thumb,
.ori-history-sidebar .ori-sidebar-body::-webkit-scrollbar-thumb,
.ori-card-selector-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 8px;
}

.ori-main-content::-webkit-scrollbar-thumb:hover,
.ori-side-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ============================================================
   缩放手柄
   ============================================================ */
.ori-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #94a3b8 50%);
    border-radius: 0 0 20px 0;
    z-index: 20;
    pointer-events: auto;
    transition: all 0.2s;
}

.ori-resize-handle:hover {
    background: linear-gradient(135deg, transparent 50%, #4f46e5 50%);
    width: 24px;
    height: 24px;
    box-shadow: 0 0 16px rgba(79, 70, 229, 0.3);
}

/* ============================================================
   全屏
   ============================================================ */
.ori-editor-container.ori-fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
}

/* ============================================================
   Toast
   ============================================================ */
.ori-toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    padding: 12px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 999999;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    animation: ori-toast-in 0.3s ease;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    max-width: 80vw;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes ori-toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* ============================================================
   弹窗控件 - 通用
   ============================================================ */
.ori-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    z-index: 200000;
    display: none;
    justify-content: center;
    align-items: center;
    animation: ori-fadeIn 0.2s ease;
}

.ori-popup-overlay.ori-active {
    display: flex;
}

.ori-popup-box {
    background: #ffffff;
    border-radius: 20px;
    max-width: 820px;
    width: 92%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    animation: ori-popup-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes ori-popup-in {
    from {
        opacity: 0;
        transform: scale(0.88) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ori-popup-box .ori-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
}

.ori-popup-box .ori-popup-header .ori-popup-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
}

.ori-popup-box .ori-popup-header .ori-popup-close {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 6px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
}

.ori-popup-box .ori-popup-header .ori-popup-close:hover {
    background: #fef2f2;
    color: #ef4444;
}

.ori-popup-box .ori-popup-body {
    flex: 1;
    padding: 16px 20px;
    overflow: auto;
}

.ori-popup-box .ori-popup-body textarea {
    width: 100%;
    border: 1.5px solid #eef2f7;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    background: #fafbfc;
    transition: border 0.2s;
    box-sizing: border-box;
    color: #0f172a;
}

.ori-popup-box .ori-popup-body textarea:focus {
    border-color: #4f46e5;
    background: #ffffff;
}

.ori-popup-box .ori-popup-body .writing-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 10px;
}

.ori-popup-box .ori-popup-body .writing-controls select,
.ori-popup-box .ori-popup-body .writing-controls input,
.ori-popup-box .ori-popup-body .writing-controls button {
    padding: 5px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    background: #fafbfc;
    color: #0f172a;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
}

.ori-popup-box .ori-popup-body .writing-controls input {
    cursor: text;
}

.ori-popup-box .ori-popup-body .writing-controls button:hover {
    background: #f1f5f9;
}

.ori-popup-box .ori-popup-body .responsive-table-container {
    width: 100%;
    overflow: auto;
    max-height: 380px;
}

.ori-popup-box .ori-popup-body .responsive-table-container table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ori-popup-box .ori-popup-body .responsive-table-container table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    font-weight: 600;
    color: #334155;
    position: sticky;
    top: 0;
    background: #f8fafc;
    z-index: 2;
}

.ori-popup-box .ori-popup-body .responsive-table-container table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f1f5f9;
}

.ori-popup-box .ori-popup-body .responsive-table-container table tr:hover td {
    background: #f8fafc;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1024px) {
    .ori-left-sidebar {
        width: 220px;
    }

    .ori-main-editor.ori-with-left {
        margin-left: 240px;
    }

    .ori-main-editor.ori-with-right {
        margin-right: 360px;
    }

    .ori-main-editor.ori-with-left.ori-with-right {
        margin-left: 240px;
        margin-right: 360px;
    }

    .ori-history-sidebar {
        width: 340px;
    }

    .ori-side-editor {
        width: 360px;
        max-width: 60vw;
    }
}

@media (max-width: 768px) {
    .ori-editor-container {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .ori-toolbar {
        border-radius: 0;
        padding: 6px 12px;
        min-height: 44px;
    }

    .ori-toolbar .ori-title {
        font-size: 15px;
    }

    .ori-toolbar-actions button {
        font-size: 12px;
        padding: 4px 8px;
    }

    .ori-body {
        padding: 6px;
    }

    .ori-left-sidebar {
        width: 76vw;
        left: 4px;
        top: 4px;
        bottom: 4px;
    }

    .ori-history-sidebar {
        width: 88vw;
        max-width: 88vw;
        right: 4px;
        top: 4px;
        bottom: 4px;
    }

    .ori-main-editor.ori-with-left {
        margin-left: 0;
    }

    .ori-main-editor.ori-with-right {
        margin-right: 0;
    }

    .ori-main-editor.ori-with-left.ori-with-right {
        margin-left: 0;
        margin-right: 0;
    }

    .ori-side-editor {
        width: 88vw;
        max-width: 88vw;
        right: 4px;
        top: 4px;
        bottom: 4px;
    }

    .ori-main-tabs .ori-tab-btn {
        font-size: 12px;
        padding: 4px 10px;
    }

    .ori-side-tabs-container .ori-side-tab-btn {
        font-size: 11px;
        padding: 3px 8px;
    }

    .ori-popup-box {
        max-width: 98%;
        max-height: 92vh;
    }

    .ori-card-selector .ori-card-selector-actions .ori-action-btn {
        padding: 10px 20px;
        font-size: 13px;
    }

    .ori-card-selector .ori-card-selector-title {
        font-size: 18px;
    }

    .ori-history-sidebar .ori-sidebar-body .ori-card-item .info .name {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .ori-toolbar-actions button {
        font-size: 11px;
        padding: 3px 6px;
    }

    .ori-toolbar .ori-title {
        font-size: 13px;
    }

    .ori-main-content {
        padding: 8px 10px;
    }

    .ori-main-content .ori-write-area .ori-chapter-row {
        flex-direction: column;
        gap: 6px;
    }

    .ori-card-selector .ori-card-selector-actions {
        flex-direction: column;
        align-items: center;
    }

    .ori-card-selector .ori-card-selector-actions .ori-action-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================================
   浮动窗口系统
   ============================================================ */
.ori-window-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 100000;
    overflow: hidden;
}

.ori-window-container .ori-window {
    position: absolute;
    min-width: 320px;
    min-height: 200px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.30);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    animation: ori-window-in 0.25s ease;
    overflow: hidden;
    backdrop-filter: blur(2px);
}

@keyframes ori-window-in {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ori-window .ori-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
    cursor: move;
    user-select: none;
    border-radius: 16px 16px 0 0;
    min-height: 40px;
}

.ori-window .ori-window-header .ori-window-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ori-window .ori-window-header .ori-window-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
}

.ori-window .ori-window-header .ori-window-close:hover {
    background: #fef2f2;
    color: #ef4444;
}

.ori-window .ori-window-body {
    flex: 1;
    padding: 14px 16px;
    overflow: auto;
    background: #ffffff;
    font-size: 14px;
    line-height: 1.7;
    color: #0f172a;
}

.ori-window .ori-window-resize {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 18px;
    height: 18px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, #cbd5e1 50%);
    border-radius: 0 0 16px 0;
    z-index: 5;
    pointer-events: auto;
    transition: all 0.2s;
}

.ori-window .ori-window-resize:hover {
    background: linear-gradient(135deg, transparent 50%, #4f46e5 50%);
    width: 22px;
    height: 22px;
}

/* ============================================================
   模态框系统
   ============================================================ */
.ori-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    z-index: 200000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: ori-modal-overlay-in 0.25s ease;
    pointer-events: auto;
}

@keyframes ori-modal-overlay-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.ori-modal {
    background: #ffffff;
    border-radius: 20px;
    max-width: 520px;
    width: 92%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
    animation: ori-modal-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
    position: relative;
}

@keyframes ori-modal-in {
    from {
        opacity: 0;
        transform: scale(0.88) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ori-modal .ori-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 10px 20px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f7;
    flex-shrink: 0;
}

.ori-modal .ori-modal-header .ori-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ori-modal .ori-modal-header .ori-modal-close {
    background: transparent;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
}

.ori-modal .ori-modal-header .ori-modal-close:hover {
    background: #fef2f2;
    color: #ef4444;
}

.ori-modal .ori-modal-body {
    padding: 18px 20px 14px 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 14px;
    line-height: 1.8;
    color: #1e293b;
}

.ori-modal .ori-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 20px 14px 20px;
    background: #fafbfc;
    border-top: 1px solid #eef2f7;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.ori-modal .ori-modal-footer .ori-modal-btn {
    padding: 7px 22px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 64px;
    text-align: center;
}

.ori-modal .ori-modal-footer .ori-modal-btn-primary {
    background: #4f46e5;
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.ori-modal .ori-modal-footer .ori-modal-btn-primary:hover {
    background: #4338ca;
    box-shadow: 0 6px 24px rgba(79, 70, 229, 0.35);
    transform: translateY(-1px);
}

.ori-modal .ori-modal-footer .ori-modal-btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.ori-modal .ori-modal-footer .ori-modal-btn-secondary:hover {
    background: #e2e8f0;
}

.ori-hidden {
    display: none !important;
}

/* 新建卡片弹窗专用 */
.ori-new-card-modal .ori-modal-body input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border 0.2s;
    box-sizing: border-box;
}

.ori-new-card-modal .ori-modal-body input[type="text"]:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08);
}

.ori-new-card-modal .ori-modal-body .hint-text {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 6px;
}
















/* ============================================================================================= */
/* 全局设置窗口样式 */
#global-settings-overlay .gs-category-btn.active {
    background: #eef2ff;
    border-left-color: #4f46e5;
    color: #4f46e5;
    font-weight: 600;
}

#global-settings-overlay .gs-category-btn:hover {
    background: #f1f5f9;
}

.gs-main-content .panel-content .setting-section {
    margin-bottom: 24px;
}

.gs-main-content .panel-content .setting-section .setting-item {
    margin-bottom: 12px;
}

.gs-main-content .panel-content .setting-section label {
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    color: #1e293b;
}

.gs-main-content .panel-content .setting-section select,
.gs-main-content .panel-content .setting-section input,
.gs-main-content .panel-content .setting-section textarea {
    width: 100%;
    padding: 6px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: #fafbfc;
    outline: none;
    transition: border 0.2s;
}

.gs-main-content .panel-content .setting-section select:focus,
.gs-main-content .panel-content .setting-section input:focus,
.gs-main-content .panel-content .setting-section textarea:focus {
    border-color: #4f46e5;
    background: #fff;
}

.gs-main-content .panel-content .btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.gs-main-content .panel-content .btn-group button {
    padding: 6px 16px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.gs-main-content .panel-content .btn-group button:hover {
    background: #f1f5f9;
}

.gs-main-content .panel-content .btn-group .btn-dark {
    background: #1e293b;
    color: #fff;
    border-color: #1e293b;
}

.gs-main-content .panel-content .btn-group .btn-dark:hover {
    background: #0f172a;
}

.gs-main-content .panel-content .module-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 12px;
}

/* 价格明细表格样式 */
.gs-main-content .panel-content .pricing-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 16px;
}

.gs-main-content .panel-content .pricing-table th {
    background: #f1f5f9;
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.gs-main-content .panel-content .pricing-table td {
    padding: 8px;
    border-bottom: 1px solid #eef2f6;
}

.gs-main-content .panel-content .pricing-table .highlight {
    background: #fef9e3;
}

/* ----- 风格标签样式 ----- */
.style-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px 6px 16px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    font-size: 14px;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    user-select: none;
    max-width: 100%;
}
.style-tag:hover {
    background: #eef2ff;
    border-color: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79,70,229,0.12);
}
.style-tag .tag-index {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    margin-right: 2px;
}
.style-tag .tag-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}
.style-tag .tag-edit-icon {
    font-size: 12px;
    color: #94a3b8;
    opacity: 0.5;
    transition: opacity 0.2s;
}
.style-tag:hover .tag-edit-icon {
    opacity: 1;
    color: #4f46e5;
}
.style-tag-empty {
    color: #94a3b8;
    font-size: 14px;
    padding: 12px 0;
    width: 100%;
    text-align: center;
}

/* ----- 编辑弹窗增强 ----- */
#style-editor-overlay {
    animation: fadeIn 0.2s ease;
}
#style-editor-overlay > div {
    animation: slideUp 0.25s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(-20px) scale(0.96); }
    to { opacity: 1; transform: translateY(-50%) scale(1); }
}







/* ----- 风格标签样式 ----- */
.style-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px 6px 14px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    font-size: 14px;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    user-select: none;
}
.style-tag:hover {
    background: #eef2ff;
    border-color: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79,70,229,0.12);
}
.style-tag .tag-index {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    margin-right: 2px;
}
.style-tag .tag-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}
.style-tag .tag-edit-icon {
    font-size: 12px;
    color: #94a3b8;
    opacity: 0.5;
    transition: opacity 0.2s;
}
.style-tag:hover .tag-edit-icon {
    opacity: 1;
    color: #4f46e5;
}
.style-tag .tag-delete {
    margin-left: 4px;
    color: #ef4444;
    font-size: 15px;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.2s, transform 0.2s;
}
.style-tag .tag-delete:hover {
    opacity: 1 !important;
    transform: scale(1.2);
}
.style-tag-empty {
    color: #94a3b8;
    font-size: 14px;
    padding: 12px 0;
    text-align: center;
    width: 100%;
}

/* 编辑弹窗动画 */
#style-editor-overlay {
    animation: fadeIn 0.2s ease;
}
#style-editor-overlay > div {
    animation: slideUp 0.25s ease;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(-20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}


.style-tag.style-tag-add {
    border: 1.5px dashed #94a3b8;
    background: #f8fafc;
    color: #4f46e5;
    transition: all 0.2s;
}
.style-tag.style-tag-add:hover {
    background: #eef2ff;
    border-color: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79,70,229,0.12);
}






/* 剧情卡侧边栏滚动条美化 */
#story-card-sidebar-list::-webkit-scrollbar {
    width: 4px;
}
#story-card-sidebar-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}
#story-card-sidebar-list::-webkit-scrollbar-track {
    background: transparent;
}
.story-card-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f1f5f9;
}
.story-card-item:hover {
    background: #f1f5f9;
}
.story-card-item.active {
    background: #eef2ff;
    border-left: 3px solid #4f46e5;
}
.story-card-item .card-num {
    font-weight:600; 
    color:#4f46e5; 
    min-width:28px; 
    font-size:13px;
}
.story-card-item .card-title {
    flex:1;
    font-size:13px;
    color:#1e293b;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
.story-card-item .card-status {
    width:8px;
    height:8px;
    border-radius:50%;
    flex-shrink:0;
}
.story-card-item .card-status.has-content {
    background:#22c55e;
}
.story-card-item .card-status.empty {
    background:#e2e8f0;
}

/* 剧情卡侧边栏滚动条美化 */
#story-card-sidebar-list::-webkit-scrollbar {
    width: 4px;
}
#story-card-sidebar-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}
#story-card-sidebar-list::-webkit-scrollbar-track {
    background: transparent;
}
.story-card-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f1f5f9;
}
.story-card-item:hover {
    background: #f1f5f9;
}
.story-card-item.active {
    background: #eef2ff;
    border-left: 3px solid #4f46e5;
}
.story-card-item .card-num {
    font-weight:600; 
    color:#4f46e5; 
    min-width:28px; 
    font-size:13px;
}
.story-card-item .card-title {
    flex:1;
    font-size:13px;
    color:#1e293b;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
.story-card-item .card-status {
    width:8px;
    height:8px;
    border-radius:50%;
    flex-shrink:0;
}
.story-card-item .card-status.has-content {
    background:#22c55e;
}
.story-card-item .card-status.empty {
    background:#e2e8f0;
}









/* 滑动开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #cbd5e1;
    transition: 0.3s;
    border-radius: 26px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .slider {
    background: #4f46e5;
}
.switch input:checked + .slider::before {
    transform: translateX(22px);
}
.switch input:disabled + .slider {
    opacity: 0.5;
    cursor: not-allowed;
}









.sidebar-resizer {
    position: absolute;
    top: 0;
    left: 0;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    z-index: 999;
    background: transparent;
    transition: background 0.2s;
    user-select: none;
    touch-action: none;
    pointer-events: auto;
}
.sidebar-resizer:hover,
.sidebar-resizer.active {
    background: rgba(79, 70, 229, 0.35);
}
body.resizing {
    user-select: none !important;
    cursor: col-resize !important;
}