/* =======================================================
   免费AI助手 - 页面内嵌版（无弹窗/无遮罩/全屏由浏览器API控制）
   ======================================================= */

/* ---------- 1. 主容器 ---------- */
#wentu-container {
    display: none;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #f8fafc;
    overflow: hidden;
    position: relative;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
}
#wentu-container.active-page {
    display: flex;
}

.wentu-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* ---------- 2. 选项卡 ---------- */
.tabs-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 16px 4px 16px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}
.tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.tab {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    background: transparent;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tab:hover {
    background: #f1f5f9;
    color: #1f2937;
}
.tab.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    border-bottom-color: white;
    margin-bottom: -1px;
}
.wentu-header-buttons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.wentu-header-buttons button {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    padding: 4px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
    color: #1e293b;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    white-space: nowrap;
}
.wentu-header-buttons button:hover {
    background: #e2e8f0;
}
.wentu-header-buttons .close-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* ---------- 3. 内容区 ---------- */
.content-section {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    padding: 16px;
    background: #f8fafc;
}
.content-section.active {
    display: flex;
}

/* ---------- 4. AI 面板（文本/多模态） ---------- */
.ai-panel-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 400px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #eef2f6;
    overflow: hidden;
}
.ai-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 16px;
    background: #fafbfc;
    border-bottom: 1px solid #eef2f6;
    flex-shrink: 0;
}
.ai-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ai-toolbar-right {
    display: flex;
    align-items: center;
}
.ai-toolbar-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    padding: 4px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 32px;
}
.ai-toolbar-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.ai-model-select {
    height: 32px;
    border: 1px solid #e2e8f0;
    border-radius: 30px;
    padding: 0 16px 0 14px;
    font-size: 13px;
    background: #fff;
    cursor: pointer;
}
.ai-session-title {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ai-chat-wrapper {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}
.ai-chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 18px;
    background: #fafcff;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.ai-chat-area::-webkit-scrollbar {
    width: 5px;
}
.ai-chat-area::-webkit-scrollbar-track {
    background: #eef2f6;
    border-radius: 4px;
}
.ai-chat-area::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* 消息气泡 */
.message-item {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeInUp 0.2s ease;
}
.message-item.user {
    align-self: flex-end;
}
.message-item.assistant {
    align-self: flex-start;
}
.message-bubble {
    padding: 8px 14px;
    border-radius: 20px;
    line-height: 1.6;
    word-break: break-word;
    font-size: 14px;
}
.message-item.user .message-bubble {
    background: #3b82f6;
    color: #fff;
    border-bottom-right-radius: 6px;
}
.message-item.assistant .message-bubble {
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #1e293b;
    border-bottom-left-radius: 6px;
}
.msg-time {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 3px;
    margin-left: 12px;
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 输入区 */
.ai-input-area {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    padding: 10px 16px 14px 16px;
    background: #ffffff;
    border-top: 1px solid #eef2f6;
    flex-shrink: 0;
}
.ai-input-area textarea {
    flex: 1;
    border: 1px solid #d1d9e6;
    border-radius: 28px;
    padding: 8px 16px;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    max-height: 200px;
    min-height: 40px;
    font-family: inherit;
    background: #fff;
    transition: all 0.2s;
    overflow: hidden;
}
.ai-input-area textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.ai-buttons {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.btn-send {
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 40px;
    padding: 0 20px;
    height: 40px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-send:hover {
    background: #2563eb;
}
.btn-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.btn-stop {
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 40px;
    padding: 0 20px;
    height: 40px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-stop:hover {
    background: #dc2626;
}

/* 媒体上传 */
.multimodal-upload-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    background: #f8fafc;
    border-top: 1px solid #eef2f6;
    border-bottom: 1px solid #eef2f6;
    flex-shrink: 0;
}
.upload-btn-multi {
    background: #ffffff;
    border: 1px solid #d1d9e6;
    border-radius: 30px;
    padding: 4px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
}
.upload-btn-multi:hover {
    background: #f1f5f9;
    border-color: #3b82f6;
}
.upload-tip {
    font-size: 11px;
    color: #94a3b8;
    margin-left: auto;
    white-space: nowrap;
}
.media-preview-list {
    padding: 6px 16px;
    min-height: 46px;
    background: #fefefe;
    border-bottom: 1px solid #eef2f6;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.media-preview-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 40px;
    padding: 3px 10px 3px 6px;
    font-size: 13px;
    color: #1e293b;
}
.media-preview-item img,
.media-preview-item video {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 6px;
}
.remove-media {
    cursor: pointer;
    color: #94a3b8;
    font-size: 14px;
}
.remove-media:hover {
    color: #ef4444;
}
.file-input-hidden {
    display: none;
}

/* ---------- 5. 历史侧边栏 ---------- */
.history-sidebar-inner {
    position: absolute;
    top: 0;
    right: 0;
    width: 340px;
    max-width: 70%;
    height: 100%;
    background: #ffffff;
    border-left: 1px solid #e2e8f0;
    box-shadow: -4px 0 12px rgba(0,0,0,0.06);
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 5;
    display: flex;
    flex-direction: column;
    padding: 16px;
    box-sizing: border-box;
    overflow: hidden;
}
.history-sidebar-inner.open {
    transform: translateX(0);
}
.history-sidebar-inner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 16px;
    color: #0f172a;
}
.history-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #94a3b8;
    padding: 0 4px;
}
.history-close-btn:hover {
    color: #ef4444;
}
.search-area {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.search-area input {
    flex: 1;
    padding: 5px 12px;
    border: 1px solid #d1d9e6;
    border-radius: 30px;
    font-size: 13px;
    outline: none;
    min-width: 80px;
}
.search-area input:focus {
    border-color: #3b82f6;
}
.search-area select {
    padding: 5px 12px;
    border: 1px solid #d1d9e6;
    border-radius: 30px;
    font-size: 13px;
    background: #fff;
}
.search-area button {
    padding: 5px 14px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
}
.history-container {
    flex: 1;
    overflow-y: auto;
}
.history-container h4 {
    margin: 8px 0 4px 0;
    font-size: 13px;
    color: #475569;
    border-bottom: 1px solid #eef2f6;
    padding-bottom: 4px;
}
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.session-card {
    background: #f8fafc;
    border-radius: 6px;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.session-card:hover {
    background: #f1f5f9;
}
.session-card-title {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.session-card-menu-btn {
    background: transparent;
    border: none;
    font-size: 16px;
    color: #94a3b8;
    cursor: pointer;
    padding: 0 4px;
}
.session-card-menu-btn:hover {
    color: #475569;
}
.session-card-menu {
    display: none;
    position: absolute;
    right: 4px;
    top: 100%;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid #e2e8f0;
    padding: 4px 0;
    min-width: 70px;
    z-index: 10;
}
.session-menu-item {
    display: block;
    width: 100%;
    padding: 4px 14px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
}
.session-menu-item:hover {
    background: #f1f5f9;
}
.session-menu-item.delete-btn {
    color: #dc2626;
}
.session-menu-item.delete-btn:hover {
    background: #fee2e2;
}

/* ---------- 6. 图片/视频生成卡片 ---------- */
.generator-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e9edf2;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    margin-bottom: 16px;
    overflow: hidden;
    flex-shrink: 0;
}
.card-header {
    background: #fafbfc;
    border-bottom: 1px solid #edf2f7;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-body {
    padding: 16px 18px;
}
.input-group {
    margin-bottom: 16px;
}
.input-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #334155;
}
.input-group textarea {
    width: 100%;
    min-height: 80px;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.85rem;
    resize: vertical;
    background: #fff;
    transition: 0.2s;
    color: #0f172a;
}
.input-group textarea:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.btn {
    padding: 5px 16px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid transparent;
}
.btn-primary {
    background: #1e293b;
    color: white;
    border-color: #1e293b;
}
.btn-primary:hover {
    background: #0f172a;
    transform: translateY(-1px);
}
.btn-secondary {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
}
.btn-secondary:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}
.btn-sm {
    padding: 3px 12px;
    font-size: 0.75rem;
}
.btn-outline {
    background: transparent;
    border-color: #cbd5e1;
}

/* ---------- 7. 结果网格 ---------- */
.results-container {
    flex: 1;
    overflow-y: auto;
    margin-top: 4px;
}
.results-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 12px;
}
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.result-card {
    display: flex;
    flex-direction: column;
    height: 400px;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #edf2f7;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -8px rgba(0,0,0,0.1);
}
.result-image {
    height: 180px;
    flex-shrink: 0;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.result-image img,
.result-image video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.result-content {
    height: 160px;
    flex-shrink: 0;
    overflow-y: auto;
    padding: 10px 12px;
    font-size: 0.8rem;
    line-height: 1.4;
    color: #334155;
    background: #ffffff;
    word-break: break-word;
}
.result-content::-webkit-scrollbar {
    width: 4px;
}
.result-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.result-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.result-actions {
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 16px;
    border-top: 1px solid #f0f2f5;
    background: #fafcff;
}

/* 视频卡片专用 */
.result-video {
    height: 160px;
    flex-shrink: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.result-video video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
}
.result-images {
    height: 80px;
    flex-shrink: 0;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    overflow: hidden;
    border-top: 1px solid #eef2f6;
    border-bottom: 1px solid #eef2f6;
}
.result-images .image-item {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f1f5f9;
}
.result-images .image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}
.result-images .no-images-placeholder {
    color: #94a3b8;
    font-size: 0.7rem;
    text-align: center;
}

.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: #64748b;
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #edf2f7;
    grid-column: 1 / -1;
}

/* ---------- 8. 参数区域 ---------- */
.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.param-item label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 2px;
}
.param-select {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #d1d9e6;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
}

/* ---------- 9. 多图预览 ---------- */
#multi_image_preview {
    flex: 1;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    min-height: 120px;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background: #f8fafc;
}
.multi-image-card {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    cursor: grab;
    background: #fff;
}
.multi-image-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.multi-image-card .remove-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.multi-image-card .drag-handle {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.4);
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    pointer-events: none;
}

/* ---------- 10. 加载动画 ---------- */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    display: inline-block;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ---------- 11. 预览模态框 ---------- */
#media-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 9999999;
    display: none;
    align-items: center;
    justify-content: center;
}
#media-modal video,
#media-modal img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}
#media-modal .modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: white;
    cursor: pointer;
    z-index: 10000000;
}

/* ---------- 12. 图库/视频库模态框 ---------- */
.modal-overlay-custom {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    z-index: 10030;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-container-custom {
    background: #ffffff;
    border-radius: 28px;
    width: 90%;
    max-width: 1000px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 45px -12px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: modalFadeIn 0.2s ease;
}
@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}
.modal-header-custom {
    padding: 16px 24px;
    border-bottom: 1px solid #eef2f6;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.modal-header-custom h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
}
.modal-close-btn-custom {
    background: #f1f5f9;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.modal-close-btn-custom:hover {
    background: #e2e8f0;
}
.modal-body-custom {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafcff;
}
.modal-grid-custom {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
}
.modal-grid-custom .library-card {
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid #eef2f6;
    overflow: hidden;
    transition: all 0.2s;
}
.modal-grid-custom .library-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px -6px rgba(0,0,0,0.1);
}
.modal-grid-custom .library-media {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    background: #f8fafc;
    cursor: pointer;
}
.modal-grid-custom .library-info {
    padding: 10px 12px;
    border-top: 1px solid #f0f2f5;
}
.modal-grid-custom .library-source {
    font-size: 0.7rem;
    color: #64748b;
    margin-bottom: 8px;
}
.modal-grid-custom .library-actions {
    display: flex;
    gap: 6px;
}
.modal-grid-custom .library-actions button {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.7rem;
    border: 1px solid #e2e8f0;
    background: #f1f5f9;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
}
.modal-grid-custom .library-actions button:hover {
    background: #e2e8f0;
}

/* ---------- 13. 批量发布侧边栏 ---------- */
#batch-publish-sidebar {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: 440px;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 10000001;
    padding: 20px;
    overflow-y: auto;
    box-sizing: border-box;
    transition: transform 0.3s;
}
#batch-publish-sidebar.open {
    display: block;
    transform: translateX(0);
}

/* ---------- 14. 移动端适配 ---------- */
@media (max-width: 768px) {
    .tabs-container {
        padding: 6px 12px 2px 12px;
    }
    .tab {
        font-size: 12px;
        padding: 4px 12px;
    }
    .wentu-header-buttons button {
        font-size: 12px;
        padding: 2px 10px;
        height: 28px;
    }
    .content-section {
        padding: 10px;
    }
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
    .result-card {
        height: 340px;
    }
    .result-image {
        height: 140px;
    }
    .result-content {
        height: 140px;
        font-size: 0.75rem;
    }
    .result-video {
        height: 120px;
    }
    .result-images {
        height: 60px;
    }
    .ai-chat-area {
        padding: 12px 14px;
    }
    .ai-input-area {
        padding: 8px 12px 10px 12px;
    }
    .ai-input-area textarea {
        font-size: 13px;
        min-height: 36px;
        padding: 6px 14px;
    }
    .btn-send, .btn-stop {
        height: 36px;
        font-size: 13px;
        padding: 0 16px;
    }
    .ai-toolbar {
        padding: 6px 12px;
    }
    .ai-toolbar-btn {
        font-size: 12px;
        padding: 3px 10px;
        height: 28px;
    }
    .ai-model-select {
        height: 28px;
        font-size: 12px;
        padding: 0 12px 0 10px;
    }
    .upload-btn-multi {
        font-size: 12px;
        padding: 3px 12px;
        height: 28px;
    }
    .upload-tip {
        font-size: 10px;
        width: 100%;
        margin-left: 0;
        order: 3;
    }
    .media-preview-list {
        padding: 4px 12px;
        min-height: 38px;
    }
    .history-sidebar-inner {
        width: 85%;
        padding: 12px;
    }
    .message-item {
        max-width: 92%;
    }
    .params-grid {
        grid-template-columns: 1fr 1fr;
    }
    .modal-container-custom {
        width: 96%;
        border-radius: 20px;
        max-height: 92vh;
    }
    .modal-grid-custom {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    #batch-publish-sidebar {
        width: 92%;
    }
}

@media (max-width: 480px) {
    .results-grid {
        grid-template-columns: 1fr 1fr;
    }
    .result-card {
        height: 300px;
    }
    .result-image {
        height: 120px;
    }
    .result-content {
        height: 120px;
    }
    .result-video {
        height: 100px;
    }
    .result-images {
        height: 50px;
    }
    .tab {
        font-size: 11px;
        padding: 3px 10px;
    }
    .params-grid {
        grid-template-columns: 1fr;
    }
    .modal-grid-custom {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* 全屏时使用浏览器 Fullscreen API，不额外定义样式 */
#wentu-container:fullscreen {
    background: #f8fafc;
}
#wentu-container:fullscreen .wentu-content {
    height: 100vh;
}