:root {
    --bg-dark: #121214;
    --bg-panel: #1e1e24;
    --bg-input: #292932;
    --primary: #FFD700;
    --primary-hover: #e6c200;
    --primary-glow: rgba(255, 215, 0, 0.35);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.12);
    --accent-green: #2ea043;
    --accent-blue: #388bfd;
    --accent-yellow: #facc15;
    --danger: #ef4444;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", sans-serif; background: var(--bg-dark); color: var(--text-main); height: 100vh; overflow: hidden; }
.workbench-app { width: 1880px; max-width: calc(100vw - 16px); height: 100%; display: flex; flex-direction: column; margin: 0 auto; padding: 8px 10px; transition: all 0.3s ease; }
header { padding: 8px 16px; background: var(--bg-panel); border: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; border-radius: 12px 12px 0 0; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
.header-left, .header-right { display: flex; align-items: center; gap: 12px; }
.header-title { font-size: 14px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; letter-spacing: 0.5px; }
.header-badge { font-size: 10px; background: rgba(255, 215, 0, 0.12); color: var(--primary); border: 1px solid rgba(255, 215, 0, 0.25); padding: 2px 6px; border-radius: 4px; font-family: monospace; }
.header-notice { color: var(--text-muted); font-size: 12px; text-align: center; padding: 3px 12px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.08); background: rgba(0, 0, 0, 0.3); }
.icon-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 15px; transition: transform 0.2s, color 0.2s; padding: 5px; border-radius: 6px; }
.icon-btn:hover { color: var(--primary); transform: scale(1.08); }
.scroll-container { flex: 1; overflow: hidden; background: var(--bg-dark); border: 1px solid var(--border-color); border-top: none; border-radius: 0 0 12px 12px; display: flex; flex-direction: row; gap: 10px; padding: 10px; min-height: 0; }
.console-panel { background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 100%; box-sizing: border-box; }
.console-panel-title { display: flex; align-items: center; gap: 7px; color: var(--text-main); font-size: 12.5px; font-weight: 700; padding: 1px 1px 4px; border-bottom: 1px solid var(--border-color); }
.console-panel-title i { color: var(--primary); }
.layout-left { flex: 0 0 338px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.layout-right { flex: 1; overflow: hidden; display: flex; flex-direction: column; background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 12px; padding: 12px; min-width: 0; }
.layout-left::-webkit-scrollbar, .gallery-pane::-webkit-scrollbar, .swatch-view-pane::-webkit-scrollbar, .prompt-pane-body::-webkit-scrollbar, .agent-custom-scroll::-webkit-scrollbar { width: 5px; height: 5px; }
.layout-left::-webkit-scrollbar-thumb, .gallery-pane::-webkit-scrollbar-thumb, .swatch-view-pane::-webkit-scrollbar-thumb, .prompt-pane-body::-webkit-scrollbar-thumb, .agent-custom-scroll::-webkit-scrollbar-thumb { background: #3a3a46; border-radius: 3px; }
.result-workspace { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.gallery-pane { flex: 1 1 auto; min-width: 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; position: relative; }
.gallery-pane.gallery-drag-active { outline: 2px dashed var(--primary); outline-offset: -2px; }
.gallery-mini-upload {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 8px;
    padding: 4px 10px;
    border: 1px dashed var(--primary);
    border-radius: 5px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    background: rgba(255,215,0,0.06);
    transition: background .15s ease, border-color .15s ease;
    white-space: nowrap;
}
.gallery-mini-upload:hover { background: rgba(255,215,0,0.14); }
.gallery-mini-upload.active { background: rgba(255,215,0,0.18); border-color: var(--primary); }
.gallery-mini-upload i { font-size: 12px; }
#galleryGlobalOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    background: rgba(10, 14, 22, 0.72);
    border: 3px dashed var(--primary);
    color: var(--primary);
    font-size: 18px;
    font-weight: 700;
    pointer-events: none;
    text-align: center;
    box-sizing: border-box;
}
#galleryGlobalOverlay i { font-size: 36px; margin-bottom: 4px; }
#galleryDropOverlay {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 50;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    background: rgba(10, 14, 22, 0.82);
    border: 2px dashed var(--primary);
    border-radius: 6px;
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
    pointer-events: none;
    box-sizing: border-box;
    text-align: center;
    padding: 12px;
}
.swatch-view-pane { flex: 1 1 auto; min-width: 0; min-height: 0; overflow-y: auto; display: none; flex-direction: column; }
.prompt-pane { flex: 0 0 440px; min-width: 330px; min-height: 0; display: flex; flex-direction: column; background: #18181f; border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; margin-left: 0; }
.prompt-pane.hidden-pane { display: none !important; }
.prompt-pane-header { flex-shrink: 0; min-height: 38px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--border-color); background: rgba(255,255,255,0.02); color: var(--text-muted); font-size: 12px; font-weight: 700; }
.prompt-pane-badge { font-family: monospace; font-size: 9px; color: var(--primary); border: 1px solid rgba(255,215,0,0.25); background: rgba(255,215,0,0.08); padding: 2px 6px; border-radius: 4px; }
.prompt-pane-body { flex: 1; min-height: 0; overflow: hidden; padding: 8px; display: flex; flex-direction: column; }
.prompt-pane-body > .section-card { flex: 1 1 auto; height: 100% !important; min-height: 0 !important; padding: 0 !important; background: transparent !important; border: none !important; box-shadow: none !important; display: flex !important; flex-direction: column !important; gap: 8px !important; }
.prompt-pane-body > .section-card > .code-box { flex: 1 1 0 !important; height: calc(50% - 4px) !important; min-height: 0 !important; overflow: hidden !important; display: flex !important; flex-direction: column !important; margin: 0 !important; }
.prompt-pane-body > .section-card > .code-box > .form-row { flex: 0 0 auto; }
.prompt-pane-body > .section-card > .code-box > pre, .prompt-pane-body > .section-card > .code-box > textarea { flex: 1 1 auto !important; min-height: 0 !important; height: auto !important; max-height: none !important; overflow-y: auto !important; }
.section-card { background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 10px; padding: 7px 9px; display: flex; flex-direction: column; gap: 5px; }
.section-header { font-size: 11.5px; color: var(--text-muted); font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.form-row { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
select, textarea, input[type="text"] { width: 100%; background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-main); border-radius: 6px; padding: 5px 8px; font-size: 11px; outline: none; transition: border-color 0.2s; font-family: inherit; }
select:focus, textarea:focus, input[type="text"]:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 36px; line-height: 1.4; }
.switch { position: relative; display: inline-block; width: 32px; height: 17px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #3f3f4c; transition: .2s; border-radius: 20px; }
.slider:before { position: absolute; content: ""; height: 13px; width: 13px; left: 2px; bottom: 2px; background-color: #94a3b8; transition: .2s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(15px); background-color: #000; }
.ref-clear-link { color: var(--primary); cursor: pointer; font-size: 11px; display: inline-flex; align-items: center; gap: 4px; }
.ref-clear-link:hover { text-decoration: underline; }
.slots-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: 100%; }
.slot-thumb { position: relative; height: 52px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border-color); background: #111; cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s; }
.slot-add { position: relative; height: 52px; border-radius: 6px; border: 1px dashed rgba(255,255,255,0.32); background: rgba(255,255,255,0.03); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-muted); font-size: 9px; cursor: pointer; transition: border-color 0.2s, background 0.2s, color 0.2s; user-select: none; }
.slot-add i { font-size: 13px; }
.slot-add:hover, .slot-add.drag-over { border-color: var(--primary); color: var(--primary); background: rgba(255,215,0,0.06); }
.slot-thumb.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.slot-thumb-badge { position: absolute; bottom: 2px; left: 3px; background: rgba(0,0,0,0.7); color: #fff; font-size: 8px; padding: 1px 4px; border-radius: 3px; font-family: monospace; pointer-events: none; }
.slot-thumb.active .slot-thumb-badge { background: var(--primary); color: #000; font-weight: bold; }
.slot-thumb img { width: 100%; height: 100%; object-fit: cover; }
.slot-thumb:hover { border-color: var(--primary); }
.slot-del { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; background: rgba(0, 0, 0, 0.75); color: #ff5555; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; transition: 0.2s; z-index: 5; }
.slot-del:hover { background: #ff4444; color: #fff; }
.drop-zone { position: relative; background: var(--bg-input); border: 1px dashed rgba(255, 255, 255, 0.22); border-radius: 8px; padding: 7px; text-align: center; cursor: default; transition: 0.2s; }
.drop-zone:hover, .drop-zone.drag-active { border-color: var(--primary); color: var(--primary); background: rgba(255, 215, 0, 0.05); }
.lamp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 3px 0; }
.lamp-grid label { display: flex; align-items: center; gap: 4px; color: var(--text-muted); font-size: 10.5px; cursor: pointer; }
.lamp-grid input { accent-color: var(--primary); cursor: pointer; }
.btn-primary { width: 100%; padding: 7px 10px; background: var(--primary); color: #000; border: none; border-radius: 6px; font-weight: 700; font-size: 12px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 12px var(--primary-glow); }
.btn-primary:disabled { background: #3f3f4c; color: #7d7d8a; cursor: not-allowed; box-shadow: none; }
.action-model-row { display: flex; align-items: stretch; gap: 6px; width: 100%; }
.action-model-select { flex: 0 0 145px; width: 145px; min-width: 0; padding: 0 8px; border-radius: 6px; border: 1px solid var(--border-color); background: #18181f; color: var(--text-main); font-size: 11px; outline: none; }
.action-model-select:focus { border-color: var(--primary); }
.action-model-button { flex: 1; min-width: 0; margin: 0 !important; }
.code-box { background: #111116; border: 1px solid var(--border-color); border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; gap: 5px; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; }
.code-box pre { font-size: 11px; line-height: 1.4; color: #a1a1aa; white-space: pre-wrap; word-break: break-all; user-select: text; }
.prompt-editable { width: 100%; height: 100%; background: #0f0f13; border: 1px solid var(--border-color); color: var(--text-main); border-radius: 6px; padding: 8px 10px; font-family: inherit; font-size: 11px; line-height: 1.45; outline: none; resize: none; white-space: pre-wrap; word-break: break-all; user-select: text; }
.workspace-tabs-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; border-bottom: 1px solid var(--border-color); padding-bottom: 6px; flex-shrink: 0; }
.workspace-tabs { display: flex; gap: 6px; align-items: center; }
.ws-tab-btn { background: #1e1e24; border: 1px solid var(--border-color); color: var(--text-muted); padding: 5px 12px; font-size: 11.5px; font-weight: 700; border-radius: 6px; cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; gap: 6px; }
.ws-tab-btn.active { background: rgba(255, 215, 0, 0.15); color: var(--primary); border-color: var(--primary); }
.ws-tab-btn:hover { color: var(--text-main); }
.ws-tab-badge { font-size: 9.5px; padding: 1px 6px; border-radius: 10px; background: rgba(255,255,255,0.08); font-family: monospace; }
.ws-tab-btn.active .ws-tab-badge { background: var(--primary); color: #000; }
.history-toolbar-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-bottom: 10px; flex-shrink: 0; }
.history-toolbar-left, .history-toolbar-right { display: flex; align-items: center; gap: 8px; }
.history-toolbar-left { justify-content: flex-start; }
.history-toolbar-right { justify-content: flex-end; }
.history-toolbar-center { display: flex; align-items: center; justify-content: center; }
.result-tool-btn { min-height: 28px; padding: 0 10px; border-radius: 5px; border: 1px solid var(--border-color); background: #25252e; color: var(--text-muted); cursor: pointer; transition: 0.2s; font-size: 11.5px; }
.result-tool-btn:hover, .result-tool-btn.active { color: var(--primary); border-color: rgba(255, 215, 0, 0.4); }
.result-scale-wrap { display: flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 11.5px; }
.scale-slider { width: 70px; accent-color: var(--primary); cursor: pointer; }
.history-drag-actions { display: none; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; flex-shrink: 0; }
.history-drag-actions.show { display: flex; }
.history-drop-zone { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 6px; border: 1px dashed rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.03); color: var(--text-main); font-size: 11.5px; transition: 0.2s; }
.history-drop-zone.delete { color: #ff8d8d; }
.history-drop-zone.download { color: #f4f4f4; }
.history-drop-zone.upload { color: var(--primary); }
.history-drop-zone.active { transform: scale(1.02); border-style: solid; }
.history-drop-zone.delete.active { background: rgba(176, 34, 34, 0.25); border-color: #ff4d4f; }
.history-drop-zone.download.active { background: rgba(255, 255, 255, 0.15); border-color: #fff; }
.history-drop-zone.upload.active { background: rgba(255, 215, 0, 0.14); border-color: var(--primary); }
.image-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; transition: 0.3s; flex: 1; align-content: start; }
.img-item { aspect-ratio: 1; background: var(--bg-input); border-radius: 10px; overflow: hidden; position: relative; border: 1px solid var(--border-color); transition: 0.2s; cursor: context-menu; animation: slide-up 0.3s cubic-bezier(0.23, 1, 0.32, 1); }
@keyframes slide-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.img-item:hover { border-color: var(--primary); }
.img-item.history-draggable { cursor: grab; }
.img-item.history-draggable.dragging { opacity: 0.35; }
.img-item.history-selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.4) inset; }
.history-card-checkbox { position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(15, 15, 15, 0.85); display: flex; align-items: center; justify-content: center; color: transparent; cursor: pointer; z-index: 6; opacity: 0; transition: 0.15s; }
.history-card-checkbox i { font-size: 10px; }
.img-item.history-multi-enabled .history-card-checkbox { opacity: 1; }
.img-item.history-selected .history-card-checkbox { background: rgba(255, 215, 0, 0.25); border-color: var(--primary); color: var(--primary); }
.img-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-del-btn { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; background: rgba(0, 0, 0, 0.7); color: #fff; border-radius: 50%; text-align: center; line-height: 22px; font-size: 10.5px; display: none; z-index: 20; cursor: pointer; transition: 0.2s; }
.img-copy-btn { position: absolute; top: 6px; right: 32px; width: 22px; height: 22px; background: rgba(0, 0, 0, 0.7); color: #fff; border-radius: 50%; text-align: center; line-height: 22px; font-size: 10.5px; display: none; z-index: 20; cursor: pointer; transition: 0.2s; }
.img-copy-btn:hover { background: var(--primary); color: #000; }
.img-item:hover .img-copy-btn { display: block; }
.img-del-btn:hover { background: var(--primary); color: #000; }
.img-item:hover .img-del-btn { display: block; }
.card-spinner { width: 26px; height: 26px; border: 2px solid #333; border-top: 2px solid var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
.img-item.thumb-pending { background: #141419; }
.img-item.thumb-pending::after { content: '生成缩略图…'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 10px; color: var(--text-muted); white-space: nowrap; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.img-item.has-error { border-color: rgba(239, 68, 68, 0.4); background: #181316; }
.empty-placeholder { grid-column: 1 / -1; text-align: center; color: var(--text-muted); padding: 40px 20px; font-size: 12.5px; background: rgba(0, 0, 0, 0.2); border: 1px dashed rgba(255, 255, 255, 0.12); border-radius: 10px; }
.history-pagination { display: flex; align-items: center; justify-content: center; gap: 8px; }
.history-pagination button { background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-main); border-radius: 5px; padding: 2px 7px; cursor: pointer; transition: 0.2s; font-size: 11px; }
.history-pagination button:hover { border-color: var(--primary); color: var(--primary); }
.history-pagination button:disabled { opacity: 0.3; cursor: not-allowed; }
.history-pagination span { font-size: 11px; color: var(--text-muted); }
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.85); display: none; justify-content: center; align-items: center; z-index: 1000; }
.modal { background: var(--bg-panel); padding: 18px; border-radius: 10px; width: 90%; max-width: 400px; border: 1px solid var(--border-color); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7); }
.preview-modal-box { width: auto; height: auto; max-width: 94vw; max-height: 92vh; background: var(--bg-dark); border-radius: 12px; display: flex; flex-direction: column; position: relative; overflow: hidden; border: 1px solid var(--border-color); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.85); transform-origin: center center; transition: transform 0.08s ease-out; }
.preview-img-container { flex: 0 0 auto; background: #09090b; display: flex; justify-content: center; align-items: center; position: relative; overflow: hidden; }
.preview-img-container img { display: block; width: auto; height: auto; max-width: 94vw; max-height: calc(92vh - 6px); object-fit: contain; cursor: grab; }
.preview-img-container img:active { cursor: grabbing; }
.preview-controls { position: fixed; left: 18px; top: 50%; transform: translateY(-50%); background: rgba(20, 20, 25, 0.72); backdrop-filter: blur(6px); border: 1px solid var(--border-color); border-radius: 8px; padding: 8px 6px; display: flex; flex-direction: column; align-items: center; gap: 12px; z-index: 410; }
.preview-controls button { background: none; border: none; color: #fff; font-size: 14px; cursor: pointer; transition: 0.2s; }
.preview-controls button:hover { color: var(--primary); }
.vertical-slider-wrapper { height: 80px; display: flex; align-items: center; justify-content: center; }
.vertical-slider { width: 65px; transform: rotate(-90deg); accent-color: var(--primary); cursor: pointer; }
.zoom-text { color: var(--primary); font-size: 10px; font-weight: bold; }
.context-menu { position: absolute; background: var(--bg-panel); border: 1px solid var(--border-color); border-radius: 6px; padding: 4px 0; display: none; z-index: 2000; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.7); }
.context-menu-item { padding: 7px 12px; font-size: 11.5px; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--text-main); }
.context-menu-item:hover { background: var(--primary); color: #000; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--primary); color: #000; padding: 7px 18px; border-radius: 20px; font-size: 12px; font-weight: 700; opacity: 0; pointer-events: none; transition: 0.25s ease; z-index: 9999; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6); }
.img-item .resolution-label { position: absolute; bottom: 4px; left: 4px; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 10px; padding: 2px 8px; border-radius: 4px; pointer-events: none; z-index: 5; font-family: monospace; letter-spacing: 0.3px; backdrop-filter: blur(2px); }
.custom-word-input { color: #fff200 !important; caret-color: #fff200 !important; }
.prompt-highlight-wrap { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.prompt-highlight-layer { position: absolute; inset: 0; z-index: 1; overflow-y: auto; padding: 8px 10px; background: #0f0f13; border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-main); font-family: inherit; font-size: 11px; line-height: 1.45; white-space: pre-wrap; word-break: break-all; overflow-wrap: anywhere; pointer-events: none; scrollbar-width: none; }
.prompt-highlight-layer::-webkit-scrollbar { display: none; }
.prompt-editable.prompt-highlight-source { position: relative; z-index: 2; background: transparent !important; color: transparent !important; caret-color: #fff200 !important; border-color: var(--border-color); }
.custom-word-highlight { color: #fff200; background: rgba(255, 242, 0, 0.13); border: 1px solid rgba(255, 242, 0, 0.38); border-radius: 3px; box-shadow: 0 0 7px rgba(255, 242, 0, 0.22); padding: 0 1px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }

/* 选中材质球在提示词中的全字段高亮与定位卡片 */
.material-prompt-highlight-block {
    display: block;
    position: relative;
    background: rgba(255, 215, 0, 0.08);
    border: 1.5px solid #ffd700;
    border-radius: 8px;
    padding: 8px 10px;
    margin: 8px 0;
    box-shadow: 0 0 18px rgba(255, 215, 0, 0.3), inset 0 0 10px rgba(255, 215, 0, 0.08);
    transition: all 0.35s ease;
}
.material-prompt-highlight-block.material-highlight-flash {
    animation: pbrMaterialFlash 1.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes pbrMaterialFlash {
    0% {
        background: rgba(255, 215, 0, 0.4);
        border-color: #ffffff;
        box-shadow: 0 0 35px rgba(255, 215, 0, 0.85), inset 0 0 25px rgba(255, 215, 0, 0.45);
        transform: scale(1.015);
    }
    100% {
        background: rgba(255, 215, 0, 0.08);
        border-color: #ffd700;
        box-shadow: 0 0 18px rgba(255, 215, 0, 0.3), inset 0 0 10px rgba(255, 215, 0, 0.08);
        transform: scale(1);
    }
}
.pbr-active-mat-banner {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 700;
    color: #000;
    background: linear-gradient(90deg, #ffd700, #ffb700);
    padding: 3px 9px;
    border-radius: 4px;
    margin-bottom: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    letter-spacing: 0.3px;
}
.pbr-mat-tag-count {
    font-size: 9px;
    background: rgba(0, 0, 0, 0.18);
    color: #1a1a22;
    padding: 1px 5px;
    border-radius: 3px;
    font-weight: 600;
    margin-left: 4px;
}
.pbr-field-line {
    display: inline;
    margin: 1px 0;
    line-height: 1.5;
}
.pbr-field-key {
    color: #ffd700 !important;
    font-weight: 700;
    background: rgba(255, 215, 0, 0.16);
    padding: 0 4px;
    border-radius: 3px;
    border: 1px solid rgba(255, 215, 0, 0.4);
    display: inline-block;
    margin: 1px 0;
}
.pbr-field-value {
    color: #58a6ff !important;
    font-weight: 600;
    background: rgba(56, 139, 253, 0.12);
    padding: 0 4px;
    border-radius: 3px;
    border: 1px solid rgba(56, 139, 253, 0.32);
    display: inline-block;
}
.pbr-field-num-val {
    color: #3fb950 !important;
    font-weight: 700;
    background: rgba(46, 160, 67, 0.16);
    padding: 0 4px;
    border-radius: 3px;
    border: 1px solid rgba(46, 160, 67, 0.4);
    display: inline-block;
}
.pbr-field-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}
.pbr-field-icon {
    font-size: 9px;
    margin-right: 2px;
    opacity: 0.9;
}

.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; padding: 8px 2px; overflow-y: auto; flex: 1; align-content: start; }
.swatch-card { position: relative; background: #1a1a22; border: 1px solid var(--border-color); border-radius: 10px; padding: 12px 8px 10px; display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1); user-select: none; }
.swatch-card:hover { border-color: var(--primary); background: #232332; transform: translateY(-4px) scale(1.02); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.7), 0 0 18px rgba(255, 215, 0, 0.25); z-index: 10; }
.swatch-ball { width: 72px; height: 72px; border-radius: 8px; margin-bottom: 8px; flex-shrink: 0; display: block; transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s ease; }
.swatch-card:hover .swatch-ball { transform: scale(1.12); filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 12px rgba(255, 215, 0, 0.35)); }
.swatch-name { font-size: 10.5px; color: var(--text-main); text-align: center; line-height: 1.3; max-height: 32px; overflow: hidden; word-break: break-word; width: 100%; font-weight: 600; }
.swatch-sub { font-size: 9px; color: var(--text-muted); margin-top: 3px; font-family: monospace; }
.swatch-mini-tags { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 8.5px; font-family: monospace; color: var(--text-muted); opacity: 0.8; transition: opacity 0.2s, color 0.2s; }
.swatch-card:hover .swatch-mini-tags { opacity: 1; color: var(--primary); }

/* 材质球悬停丰富参数与应用场景浮层 */
.swatch-hover-popover {
    position: fixed;
    z-index: 99990;
    width: 320px;
    max-width: 90vw;
    background: rgba(18, 18, 26, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 215, 0, 0.45);
    border-radius: 12px;
    padding: 13px 15px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.85), 0 0 25px rgba(255, 215, 0, 0.16);
    color: var(--text-main);
    pointer-events: none;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.swatch-hover-popover.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.swatch-popover-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
    margin-bottom: 9px;
}
.swatch-popover-title-wrap {
    flex: 1;
    min-width: 0;
}
.swatch-popover-title {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    line-height: 1.35;
    word-break: break-word;
}
.swatch-popover-mat {
    font-size: 10px;
    color: var(--primary);
    margin-top: 2px;
    font-weight: 600;
    display: inline-block;
    background: rgba(255, 215, 0, 0.1);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 215, 0, 0.25);
}
.swatch-popover-badge {
    font-size: 10px;
    font-family: monospace;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}
.swatch-popover-specs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 11px;
    margin-bottom: 10px;
}
.swatch-spec-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.swatch-spec-key {
    color: var(--text-muted);
    font-size: 10.5px;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.swatch-spec-val-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
}
.swatch-spec-bar-track {
    width: 65px;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}
.swatch-spec-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #388bfd, var(--primary));
    transition: width 0.3s ease;
}
.swatch-spec-num {
    font-family: monospace;
    font-size: 10px;
    color: var(--text-main);
    min-width: 30px;
    text-align: right;
}
.swatch-color-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    font-family: monospace;
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 7px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.swatch-color-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}
.swatch-popover-tip {
    background: rgba(46, 160, 67, 0.12);
    border: 1px solid rgba(46, 160, 67, 0.3);
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
    font-size: 11px;
    line-height: 1.45;
    color: #c7eed0;
}
.swatch-popover-tip-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 700;
    color: var(--accent-green);
    margin-bottom: 3px;
    font-size: 10.5px;
}
.swatch-popover-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 9.5px;
    color: var(--text-muted);
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    padding-top: 6px;
}
.btn-sub { border-radius: 4px; border: 1px solid var(--border-color); background: #25252e; color: var(--text-main); cursor: pointer; transition: 0.2s; outline: none; }
.btn-sub:hover { border-color: var(--primary); }
.material-detail-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); backdrop-filter: blur(6px); z-index: 99999; display: none; align-items: center; justify-content: center; }
.material-detail-box { background: #1e1e26; border: 1px solid var(--primary); border-radius: 12px; padding: 24px 28px; max-width: 520px; width: 92%; max-height: 75vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.9); }
.material-detail-box h3 { color: var(--text-main); border-bottom: 1px solid var(--border-color); padding-bottom: 8px; margin-bottom: 12px; font-size: 15px; }
.material-detail-box .param-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 11.5px; font-family: monospace; border-bottom: 1px solid rgba(255,255,255,0.05); }
.material-detail-box .param-key { color: var(--text-muted); margin-right: 16px; flex-shrink: 0; }
.material-detail-box .param-value { color: var(--text-main); word-break: break-all; text-align: right; }
.agent-drawer-tab { position: fixed; top: 50%; right: 0; transform: translateY(-50%); background: #1e1e24; border: 1px solid var(--primary); border-right: none; border-radius: 10px 0 0 10px; padding: 12px 6px; color: var(--primary); cursor: pointer; z-index: 1040; box-shadow: -4px 0 20px rgba(0, 0, 0, 0.7), 0 0 10px rgba(255, 215, 0, 0.25); transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1); display: flex; flex-direction: column; align-items: center; gap: 8px; writing-mode: vertical-rl; text-orientation: mixed; font-size: 11px; font-weight: 700; letter-spacing: 1.5px; }
.agent-drawer-tab:hover { background: #282834; color: #fff; padding-left: 9px; box-shadow: -6px 0 25px rgba(255, 215, 0, 0.4); }
.agent-drawer-tab i { writing-mode: horizontal-tb; font-size: 13px; }
.agent-drawer-panel { position: fixed; top: 0; right: 0; width: 480px; max-width: 96vw; height: 100vh; background: #141419; border-left: 1px solid var(--border-color); box-shadow: -10px 0 35px rgba(0, 0, 0, 0.85); z-index: 1050; display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1); }
.agent-drawer-panel.open { transform: translateX(0); }
.agent-drawer-panel.drag-over-active { box-shadow: -10px 0 45px rgba(255, 215, 0, 0.35); border-left: 2px dashed var(--primary); }
.agent-header { height: 46px; background: var(--bg-panel); border-bottom: 1px solid var(--border-color); padding: 0 14px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; user-select: none; }
.agent-bubble-user { background: #2a2a38; border: 1px solid rgba(255, 215, 0, 0.25); color: var(--text-main); border-radius: 12px 12px 2px 12px; padding: 10px 12px; font-size: 12px; line-height: 1.5; max-width: 85%; word-break: break-word; }
.agent-bubble-ai { background: #1c1c24; border: 1px solid var(--border-color); color: var(--text-main); border-radius: 12px 12px 12px 2px; padding: 12px 14px; font-size: 12px; line-height: 1.55; width: 100%; word-break: break-word; }
.agent-quick-btn { background: var(--bg-input); border: 1px solid var(--border-color); color: var(--text-main); border-radius: 6px; padding: 6px 10px; font-size: 11px; cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px; }
.agent-quick-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(255, 215, 0, 0.08); }
.at-mention-menu { position: absolute; left: 8px; bottom: calc(100% + 6px); width: calc(100% - 16px); max-height: 280px; background: #1a1a22; border: 1px solid var(--primary); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9); z-index: 2100; display: flex; flex-direction: column; overflow: hidden; }
.at-mention-header { padding: 7px 10px; font-size: 11px; font-weight: 700; color: var(--primary); background: rgba(0, 0, 0, 0.3); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.at-mention-grid { padding: 8px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; overflow-y: auto; max-height: 230px; }
.at-mention-thumb { position: relative; height: 62px; border-radius: 6px; overflow: hidden; border: 1px solid var(--border-color); cursor: pointer; background: #101014; transition: border-color 0.2s, transform 0.15s; }
.at-mention-thumb:hover { border-color: var(--primary); transform: scale(1.03); }
.at-mention-thumb.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.at-mention-thumb img { width: 100%; height: 100%; object-fit: cover; }
.at-mention-tag { position: absolute; bottom: 2px; left: 2px; font-size: 8px; padding: 1px 4px; border-radius: 3px; background: rgba(0, 0, 0, 0.75); color: #fff; font-family: monospace; pointer-events: none; }
.at-mention-thumb.selected .at-mention-tag { background: var(--primary); color: #000; font-weight: bold; }
.agent-attached-tray { display: flex; align-items: center; gap: 6px; overflow-x: auto; padding: 6px 4px; background: #111116; border: 1px dashed var(--border-color); border-radius: 8px; margin-bottom: 6px; }
.agent-tray-item { position: relative; width: 44px; height: 44px; border-radius: 6px; overflow: hidden; border: 1px solid var(--primary); flex-shrink: 0; }
.agent-tray-item img { width: 100%; height: 100%; object-fit: cover; }
.agent-tray-del { position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; background: rgba(0,0,0,0.8); color: #ff5555; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; cursor: pointer; }
.agent-tray-del:hover { background: #ff4444; color: #fff; }
.prompt-editable.manual-mode {
    border-color: var(--accent-yellow) !important;
    box-shadow: 0 0 0 1px var(--accent-yellow) inset, 0 0 12px rgba(250, 204, 21, 0.15);
}

/* 增加一个指示灯的动画效果 */
@keyframes pulse-yellow {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}
.manual-mode-indicator {
    color: var(--accent-yellow);
    font-size: 10px;
    animation: pulse-yellow 2s infinite;
}

/* 迷你模式切换开关样式 */
.agent-mode-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.agent-mode-label {
    font-size: 10px;
    font-weight: 700;
    min-width: 44px;
    transition: 0.2s;
}
.amgo-switch-mini {
    position: relative;
    display: inline-block;
    width: 26px;
    height: 14px;
}
.amgo-switch-mini input { opacity: 0; width: 0; height: 0; }
.amgo-slider-mini {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #3f3f4c; transition: .2s; border-radius: 20px;
}
.amgo-slider-mini:before {
    position: absolute; content: ""; height: 10px; width: 10px; left: 2px; bottom: 2px;
    background-color: #94a3b8; transition: .2s; border-radius: 50%;
}
input:checked + .amgo-slider-mini { background-color: var(--primary); }
input:checked + .amgo-slider-mini:before { transform: translateX(12px); background-color: #000; }

/* 模式状态视觉反馈 */
.agent-drawer-panel.dialogue-mode { border-left: 1px solid #444; }
.agent-drawer-panel.work-mode { border-left: 1px solid var(--primary); }

        /* 针对 Header 内开关的微调 */
        .agent-header .switch { width: 28px !important; height: 15px !important; }
        .agent-header .slider:before { height: 11px !important; width: 11px !important; left: 2px !important; bottom: 2px !important; }
        .agent-header input:checked + .slider:before { transform: translateX(13px) !important; }

/* === 主参考图区 一键清空按钮（上传区右上角） === */
.clear-slots-btn { position: absolute; top: 6px; right: 6px; z-index: 10; padding: 2px 8px; font-size: 10px; color: var(--danger); border-color: rgba(239,68,68,0.4); background: rgba(0,0,0,0.55); display: inline-flex; align-items: center; gap: 4px; }
.clear-slots-btn:hover { color: #fff; background: rgba(239,68,68,0.85); border-color: var(--danger); }

/* === 场景人物自定义 · 人物垫图上传区 === */
.person-ref-zone { width: 96px; min-height: 62px; flex-shrink: 0; border: 1px dashed rgba(255,215,0,0.4); border-radius: 8px; background: rgba(0,0,0,0.25); cursor: pointer; display: flex; align-items: center; justify-content: center; position: relative; transition: border-color 0.2s, background 0.2s; overflow: hidden; }
.person-ref-zone:hover, .person-ref-zone.drag-active { border-color: var(--primary); background: rgba(255,215,0,0.06); }
.person-ref-slots { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; padding: 4px; align-content: flex-start; }
.person-ref-thumb { position: relative; width: 40px; height: 40px; border-radius: 6px; overflow: hidden; border: 1px solid var(--primary); flex-shrink: 0; }
.person-ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.person-ref-del { position: absolute; top: 1px; right: 1px; width: 14px; height: 14px; background: rgba(0,0,0,0.8); color: #ff5555; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; cursor: pointer; z-index: 5; line-height: 1; }
.person-ref-del:hover { background: #ff4444; color: #fff; }
.person-ref-empty { color: var(--text-muted); font-size: 10px; text-align: center; padding: 10px 4px; line-height: 1.5; }


/* === AMGO 协同生图 & 卷帘对比（自动追加）=== */
/* 协同生图：参考图绿色外框（主图为金色，参考图为绿色） */
.slot-thumb.refslot { border-color: var(--accent-green); box-shadow: 0 0 0 2px var(--accent-green); }
.slot-thumb.refslot .slot-thumb-badge { background: var(--accent-green); color: #04140a; font-weight: bold; }
.slot-thumb.refslot:hover { border-color: var(--accent-green); }
.slot-thumb.active.refslot { border-color: var(--accent-green); box-shadow: 0 0 0 2px var(--accent-green); }

/* 预览卷帘对比：原图叠加层铺满由成图撑开的容器；默认隐藏，comparing 时显示。
   选择器特异性必须高于既有的 .preview-img-container img{display:block;object-fit:contain} */
.preview-img-container img.preview-orig-layer { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: fill; display: none; z-index: 2; cursor: grab; }
.preview-img-container.comparing img.preview-orig-layer { display: block; }
.preview-img-container img.preview-orig-layer:active { cursor: grabbing; }
.preview-img-container .preview-compare-handle { position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; transform: translateX(-50%); background: #ffffff; z-index: 4; cursor: ew-resize; display: none; box-shadow: 0 0 8px rgba(0,0,0,0.9); }
.preview-img-container .preview-compare-handle::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 28px; height: 28px; border-radius: 50%; background: #ffffff; box-shadow: 0 2px 8px rgba(0,0,0,0.6); }
.preview-img-container.comparing .preview-compare-handle { display: block; }
.preview-img-container .preview-tag { position: absolute; top: 10px; z-index: 5; padding: 2px 9px; border-radius: 5px; font-size: 11px; font-weight: bold; color: #fff; display: none; pointer-events: none; letter-spacing: 1px; }
.preview-tag-orig { left: 12px; background: rgba(34,197,94,0.92); }
.preview-tag-render { right: 12px; background: rgba(0,0,0,0.65); }
.preview-img-container.comparing .preview-tag { display: block; }
#btnPreviewCompare { display: none; }
#btnPreviewCompare.active { color: var(--accent-green); }

/* === AMGO 底图拖拽排序 & 提示词屏蔽开关（自动追加 261004）=== */
.slot-thumb.dragging { opacity: .35; }
.slot-thumb.drag-over {
    outline: 2px dashed var(--primary);
    outline-offset: -3px;
    box-shadow: 0 0 0 2px rgba(255,215,0,.25) inset;
}
.prompt-mute-lbl {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    cursor: pointer;
    color: var(--text-muted);
    white-space: nowrap;
    user-select: none;
}
.prompt-mute-lbl input { cursor: pointer; margin: 0; }
.prompt-mute-lbl:has(input:checked) { color: #ff8a8a; }
.prompt-mute-lbl:has(input:checked) span { text-decoration: line-through; }

/* === IMAGE GENERATION PROMPT 优化布局 === */
.prompt-generation-box {
    background: #111116;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.prompt-generation-box:focus-within {
    border-color: rgba(255, 215, 0, 0.4);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.12);
}
.prompt-gen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
    flex-shrink: 0;
}
.prompt-gen-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.prompt-gen-title {
    color: var(--accent-yellow);
    font-weight: 700;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.prompt-gen-title i {
    color: var(--accent-yellow);
    font-size: 11px;
}
.prompt-mode-group {
    display: flex;
    align-items: center;
    gap: 4px;
}
.prompt-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    padding: 2px 7px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    user-select: none;
}
.prompt-pill-btn:hover {
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.25);
}
.prompt-pill-btn input[type="checkbox"] {
    accent-color: var(--accent-yellow);
}
.prompt-preset-select {
    width: auto !important;
    max-width: 125px;
    padding: 2px 6px !important;
    font-size: 10px !important;
    height: 22px;
}
.prompt-mini-btn {
    padding: 1px 6px !important;
    font-size: 10px !important;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.prompt-gen-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}
.prompt-lock-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    padding: 2px 8px;
    background: rgba(255, 215, 0, 0.09);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 14px;
    cursor: pointer;
    color: var(--primary);
    transition: all 0.2s;
    user-select: none;
    white-space: nowrap;
}
.prompt-lock-toggle:hover {
    background: rgba(255, 215, 0, 0.18);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}
.prompt-lock-toggle input[type="checkbox"] {
    cursor: pointer;
    margin: 0;
    accent-color: var(--primary);
}
.prompt-expand-btn {
    padding: 2px 7px !important;
    font-size: 10px !important;
    color: var(--accent-yellow) !important;
    border-color: rgba(250, 204, 21, 0.35) !important;
    white-space: nowrap;
}
.prompt-container-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    margin-top: 5px;
    border-radius: 6px;
    overflow: hidden;
}
.prompt-box-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-top: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 4px;
    flex-shrink: 0;
}
.prompt-footer-left {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 9.5px;
    color: var(--text-muted);
    font-family: monospace;
}
.prompt-char-tag {
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 6px;
    border-radius: 4px;
}
.prompt-hint-tag {
    color: var(--accent-green);
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.prompt-footer-right {
    display: flex;
    align-items: center;
    gap: 4px;
}
.prompt-foot-btn {
    padding: 1px 7px !important;
    font-size: 10px !important;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* === 移动端顶部导航栏 === */
.mobile-tab-nav {
    display: none;
    background: #181820;
    border-bottom: 1px solid var(--border-color);
    padding: 4px 6px;
    gap: 6px;
    flex-shrink: 0;
    user-select: none;
    z-index: 100;
}
.mobile-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    background: #22222d;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}
.mobile-tab-btn.active {
    background: rgba(255, 215, 0, 0.15);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.mobile-tab-badge {
    font-size: 10px;
    font-family: monospace;
    background: rgba(255,255,255,0.1);
    color: inherit;
    padding: 1px 6px;
    border-radius: 10px;
}
.mobile-tab-btn.active .mobile-tab-badge {
    background: var(--primary);
    color: #000;
}

/* === 媒体查询：手机及平板小屏幕响应式 (<= 900px) === */
@media (max-width: 900px) {
    html, body {
        height: 100%;
        height: 100dvh;
        overflow: hidden;
    }
    .workbench-app {
        width: 100vw;
        max-width: 100vw;
        height: 100%;
        height: 100dvh;
        padding: 0;
        margin: 0;
        border-radius: 0;
    }
    header {
        border-radius: 0;
        padding: 6px 10px;
        border-left: none;
        border-right: none;
        border-top: none;
    }
    .header-title {
        font-size: 13px;
    }
    .header-badge {
        display: none;
    }
    .mobile-tab-nav {
        display: flex;
    }
    .scroll-container {
        flex-direction: column;
        padding: 6px;
        gap: 0;
        border-radius: 0;
        border: none;
        min-height: 0;
        flex: 1;
        overflow: hidden;
    }
    .layout-left {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        padding-right: 0 !important;
        overflow-y: auto !important;
        min-height: 0 !important;
    }
    .layout-right {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 6px !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }
    .prompt-pane {
        flex: 1 1 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        border-radius: 8px !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }
    .agent-drawer-panel {
        width: 100vw !important;
        max-width: 100vw !important;
    }
    .agent-drawer-tab {
        display: none !important;
    }
    .image-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }
    .history-toolbar-row {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: space-between !important;
        gap: 6px !important;
    }
    .result-scale-wrap {
        display: none !important;
    }
    .material-detail-box, .text-editor-box {
        width: 95vw !important;
        max-width: 95vw !important;
        padding: 16px !important;
    }
    .slots-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .image-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 5px !important;
    }
    .swatch-grid {
        grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)) !important;
        gap: 6px !important;
    }
    .swatch-card {
        padding: 8px 4px 6px !important;
    }
    .swatch-ball {
        width: 52px !important;
        height: 52px !important;
    }
    .slots-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .prompt-gen-title {
        font-size: 10px;
    }
    .prompt-lock-toggle {
        font-size: 9.5px;
        padding: 2px 6px;
    }
}

/* === 材质球矩阵头部工具栏 === */
.swatch-toolbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 11px;
    padding: 4px 6px 8px;
    border-bottom: 1px dashed var(--border-color);
    margin-bottom: 8px;
    flex-shrink: 0;
    gap: 8px;
    flex-wrap: wrap;
}
.swatch-toolbar-left, .swatch-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}
.swatch-title-tag {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}
.swatch-title-tag i { color: var(--primary); }
.swatch-total-badge {
    color: var(--primary);
    font-weight: bold;
    font-size: 10.5px;
    background: rgba(255, 215, 0, 0.1);
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.25);
}
.swatch-tool-btn {
    padding: 3px 9px !important;
    font-size: 11px !important;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.swatch-tool-btn.active {
    color: var(--primary) !important;
    border-color: rgba(255, 215, 0, 0.5) !important;
    background: rgba(255, 215, 0, 0.12) !important;
}

/* === 选中材质的 Recharts 物理属性雷达图面板 === */
.selected-material-radar-panel {
    background: #14141b;
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 10px 14px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
    transition: all 0.25s ease;
}
.radar-panel-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.radar-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 7px;
    flex-wrap: wrap;
}
.radar-mat-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.radar-ball-preview {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset -2px -2px 6px rgba(0,0,0,0.8), 0 2px 8px rgba(0,0,0,0.5);
    flex-shrink: 0;
    background: #808080;
}
.radar-mat-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.radar-mat-title {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}
.radar-mat-chip {
    font-size: 9.5px;
    background: rgba(255, 215, 0, 0.12);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: var(--primary);
    padding: 1px 6px;
    border-radius: 4px;
}
.radar-mat-sub {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 1px;
}
.radar-content-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.radar-chart-wrap {
    flex: 1 1 280px;
    min-width: 260px;
    height: 230px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: radial-gradient(circle at 50% 38%, rgba(30, 30, 44, 0.6) 0%, rgba(13, 13, 18, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.6);
}
.radar-placeholder-hint {
    color: var(--text-muted);
    font-size: 11px;
    text-align: center;
    padding: 40px 0;
}
.radar-metrics-list {
    flex: 1 1 260px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}
.radar-metric-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.radar-metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: var(--text-muted);
}
.radar-metric-val {
    font-size: 13px;
    font-family: monospace;
    font-weight: 700;
    color: var(--primary);
}
.radar-metric-sub {
    font-size: 9px;
    color: var(--text-muted);
    line-height: 1.2;
}

/* === 材质球矩阵卡片增强选中与编辑按钮 === */
.swatch-card.selected-card {
    border-color: var(--primary) !important;
    background: #242434 !important;
    box-shadow: 0 0 0 2px var(--primary), 0 8px 24px rgba(0, 0, 0, 0.7) !important;
}
.swatch-edit-trigger {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 215, 0, 0.35);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0.65;
    z-index: 5;
}
.swatch-card:hover .swatch-edit-trigger, .swatch-card.selected-card .swatch-edit-trigger {
    opacity: 1;
    transform: scale(1.08);
    background: rgba(255, 215, 0, 0.2);
}
.swatch-edit-trigger:hover {
    background: var(--primary) !important;
    color: #000 !important;
}

/* === 材质自定义编辑模态框 (含实时 Recharts 雷达图联动) === */
.material-editor-modal-box {
    background: #16161e;
    border: 1px solid var(--primary);
    width: 92%;
    max-width: 920px;
    max-height: 88vh;
    border-radius: 14px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.95), 0 0 35px rgba(255, 215, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.material-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}
.mat-edit-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}
.mat-edit-ball-preview {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    box-shadow: inset -4px -4px 10px rgba(0,0,0,0.85), inset 4px 4px 10px rgba(255,255,255,0.25), 0 4px 12px rgba(0,0,0,0.6);
    flex-shrink: 0;
    background: #808080;
}
.material-editor-body {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: 18px;
    padding: 16px 20px;
    overflow-y: auto;
}
.material-editor-form-col {
    flex: 1.2;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 11px;
    overflow-y: auto;
    padding-right: 6px;
}
.material-editor-preview-col {
    flex: 0.9;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.edit-field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.edit-field-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.edit-field-label i { color: var(--primary); font-size: 11px; }
.edit-field-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.edit-physics-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 215, 0, 0.25);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.edit-physics-title {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
}
.edit-slider-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
}
.edit-slider-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.slider-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10.5px;
    color: var(--text-muted);
}
.slider-val {
    font-family: monospace;
    color: var(--primary);
    font-weight: 700;
    font-size: 11px;
}
.slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.slider-row input[type="range"], .edit-slider-item input[type="range"] {
    accent-color: var(--primary);
    cursor: pointer;
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.12);
}
.editor-radar-box {
    background: #111117;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.editor-radar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-main);
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.editor-radar-tag {
    font-size: 9px;
    font-family: monospace;
    background: rgba(46, 160, 67, 0.15);
    border: 1px solid rgba(46, 160, 67, 0.35);
    color: var(--accent-green);
    padding: 1px 5px;
    border-radius: 4px;
}
.editor-radar-summary {
    margin-top: 8px;
    font-size: 10.5px;
    line-height: 1.45;
    color: var(--text-muted);
    border-top: 1px dashed rgba(255, 255, 255, 0.08);
    padding-top: 8px;
}
.material-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    gap: 12px;
    flex-wrap: wrap;
}

@media (max-width: 900px) {
    .material-editor-body {
        flex-direction: column;
    }
    .material-editor-preview-col {
        min-width: 100%;
    }
    .radar-content-row {
        flex-direction: column;
    }
    .radar-chart-wrap {
        width: 100%;
    }
    .radar-metrics-list {
        width: 100%;
    }
}

/* === Agent 工具执行时间线卡片 (Tool Execution Timeline) === */
.agent-tool-timeline {
    display: none;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: rgba(18, 18, 26, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    font-size: 11px;
}
.agent-tool-timeline:not(:empty) {
    display: flex;
}
.agent-timeline-step {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.25s ease;
}
.agent-timeline-step.running {
    border-color: rgba(255, 215, 0, 0.35);
    background: rgba(255, 215, 0, 0.05);
}
.agent-timeline-step.success {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.04);
}
.agent-timeline-step.error {
    border-color: rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.05);
}
.agent-timeline-step-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.agent-timeline-icon {
    font-size: 12px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}
.agent-timeline-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-main, #eee);
    font-size: 11px;
}
.agent-timeline-badge {
    font-size: 9.5px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    letter-spacing: 0.3px;
}
.agent-timeline-badge.badge-running {
    color: var(--primary, #ffd700);
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
}
.agent-timeline-badge.badge-success {
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.agent-timeline-badge.badge-error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Agent 思维流式容器 */
.agent-thought-container {
    margin-bottom: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 2px solid var(--accent-blue, #60a5fa);
    border-radius: 4px;
    font-size: 11px;
    color: #9ca3af;
    line-height: 1.5;
}
.agent-thought-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: #93c5fd;
    font-size: 10px;
    margin-bottom: 4px;
    cursor: pointer;
    user-select: none;
}

/* === Agent 任务进度折叠卡片 === */
.agent-timeline-wrap {
    margin-bottom: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(18, 18, 26, 0.75);
    overflow: hidden;
}
.agent-timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    cursor: pointer;
    user-select: none;
    font-size: 11px;
    color: var(--text-main, #eee);
    background: rgba(255, 255, 255, 0.03);
}
.agent-timeline-header:hover { background: rgba(255, 215, 0, 0.08); }
.agent-timeline-count { color: #9ca3af; font-weight: 400; margin-left: 4px; }
.agent-timeline-arrow { color: #9ca3af; font-size: 10px; font-weight: 400; white-space: nowrap; }
.agent-timeline-wrap .agent-tool-timeline {
    margin-bottom: 0;
    padding: 8px 12px;
    border: none;
    border-radius: 0;
    background: transparent;
}

/* 画廊任务卡片右下角生图模型小字 */
.img-item .card-model-tag {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.65);
    color: var(--primary, #ffd700);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 5;
    font-family: monospace;
    letter-spacing: 0.2px;
    backdrop-filter: blur(2px);
    max-width: 72%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 画廊渲染参考图角标：卡片左上角黄绿"空间参考"标签 */
.gallery-ref-badge {
    position: absolute;
    top: 6px;
    left: 32px;
    padding: 2px 7px;
    background: rgba(212, 255, 63, 0.16);
    border: 1px solid #d4ff3f;
    color: #d4ff3f;
    border-radius: 3px;
    font-size: 10px;
    line-height: 1.3;
    letter-spacing: 0.5px;
    z-index: 6;
    font-weight: 700;
    pointer-events: none;
    box-shadow: 0 0 8px rgba(212, 255, 63, 0.35);
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

/* 右键菜单：首项（设为/取消协同参考图）高亮，次项（清空）分隔线 */
.context-menu-item.ctx-toggle-ref {
    padding: 9px 12px;
    background: rgba(212, 255, 63, 0.12);
    border-bottom: 1px solid var(--border-color);
    color: #d4ff3f;
    font-weight: 700;
}
.context-menu-item.ctx-toggle-ref:hover { background: #d4ff3f; color: #000; }
.context-menu-item.ctx-clear-ref { border-bottom: 1px solid var(--border-color); }
