:root { --bg-main: #fdfdfd; --sidebar-bg: #f5f5f7; --text-primary: #1d1d1f; --border: rgba(0,0,0,0.08); --chat-font-size: 15px; }
html, body { height: 100%; width: 100%; margin: 0; padding: 0; overflow: hidden; background: var(--bg-main); color: var(--text-primary); font-family: -apple-system, system-ui, sans-serif; }
body { display: flex; flex-direction: row; }
main { flex: 1; height: 100%; display: flex; flex-direction: column; position: relative; min-width: 0; overflow: hidden; } 
header { height: 56px; padding: 0 15px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.9); z-index: 10; }
#chat-container { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 24px; position: relative; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
footer { padding: 15px; border-top: 1px solid var(--border); background: #fff; display: flex; flex-direction: column; flex-shrink: 0; }
aside { width: 280px; height: 100%; background: var(--sidebar-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; transition: transform 0.3s ease; z-index: 1500; flex-shrink: 0;}
#sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 1400; display: none; backdrop-filter: blur(2px); }
.folder-item { padding: 10px; margin-top: 15px; margin-bottom: 5px; cursor: pointer; font-size: 12px; font-weight: 600; color: #888; text-transform: uppercase; display: flex; align-items: center; justify-content: space-between; border-radius: 8px; transition: background 0.2s; }
.folder-item:hover { color: #000; background: rgba(0,0,0,0.05); }
.history-item { padding: 12px; margin-bottom: 5px; border-radius: 10px; cursor: pointer; font-size: 14px; color: #555; display: flex; align-items: center; justify-content: space-between; transition: all 0.2s; position: relative; }
.history-item.nested { margin-left: 15px; border-left: 2px solid rgba(0,0,0,0.1); border-radius: 0 10px 10px 0; }
.history-item:hover, .history-item.active { background: #fff; color: #000; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.history-item .actions { display: none; gap: 8px; }
.history-item:hover .actions, .history-item.active .actions { display: flex; }
.action-btn { font-size: 14px; opacity: 0.5; cursor: pointer; }
.action-btn:hover { opacity: 1; color: #000; }
#prompt-select, #mode-select { padding: 6px; border-radius: 6px; border: 1px solid #ddd; outline: none; font-size: 13px; background: transparent; cursor: pointer; max-width: 150px; text-overflow: ellipsis;}
.font-controls { display: flex; gap: 5px; margin-left: 10px; }
.message-wrap { display: flex; flex-direction: column; z-index: 2; max-width: 100%; min-width: 0; }
.wrap-user { align-self: flex-end; align-items: flex-end; max-width: 85%; }
.wrap-ai { align-self: flex-start; max-width: 100%; }
.message, .msg-content { font-size: var(--chat-font-size); line-height: 1.7; overflow-wrap: anywhere; word-break: break-word; max-width: 100%; min-width: 0; transition: font-size 0.2s ease; }
.message p, .message li, .message table { font-size: 1em; } 
.message h1, .message h2, .message h3, .message h4 { margin: 1em 0 0.5em 0; font-weight: 700; color: #111; line-height: 1.3; }
.message h1 { font-size: 1.3em; } .message h2 { font-size: 1.2em; } .message h3 { font-size: 1.1em; } .message h4 { font-size: 1em; }
.message p { margin: 0.6em 0; }
.message ul, .message ol { padding-left: 1.5em; margin: 0.5em 0; }
.message li { margin-bottom: 0.3em; }
.message table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 0.95em; display: block; overflow-x: auto; white-space: nowrap; }
.message th, .message td { border: 1px solid #ddd; padding: 8px 12px; }
.message th { background: #f9f9f9; }
.message strong { color: #000; font-weight: 700; }
.wrap-ai .message { padding: 5px 15px; border-left: 2px solid #000; }
.wrap-user .message { background: #000; color: #fff; padding: 12px 18px; border-radius: 18px 18px 2px 18px; position: relative; }
.wrap-user .msg-content { max-height: 120px; overflow: hidden; transition: max-height 0.3s ease; }
.wrap-user .msg-content.expanded { max-height: none; }
.wrap-user .msg-footer { justify-content: flex-end; }
pre { background: #f6f8fa; padding: 16px; border-radius: 12px; position: relative; margin: 10px 0; border: 1px solid #eee; overflow-x: auto; white-space: pre-wrap; word-break: break-word; font-size: calc(var(--chat-font-size) * 0.9); transition: font-size 0.2s ease; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace; font-size: inherit; }
.code-copy { position: absolute; top: 8px; right: 8px; padding: 4px 8px; font-size: 11px; background: #fff; border: 1px solid #ddd; border-radius: 5px; cursor: pointer; opacity: 0.6; transition: 0.2s; }
.code-copy:hover { opacity: 1; background: #000; color: #fff; }

.msg-footer { display: flex; opacity: 0; transition: 0.2s; padding-left: 10px; user-select: none; gap: 8px; align-items: center; width: 100%; }
.message-wrap:hover .msg-footer { opacity: 1; }
.icon-btn { background: transparent; border: none; color: #888; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 6px; border-radius: 6px; transition: 0.2s; }
.icon-btn:hover { background: rgba(0,0,0,0.05); color: #000; }
.icon-btn-danger:hover { background: rgba(231, 76, 60, 0.1); color: #e74c3c; }

.thinking-box { display: flex; align-items: center; gap: 10px; color: #555; font-size: 14px; font-weight: 600; animation: pulse 1.5s infinite; }
.spinner { width: 16px; height: 16px; border: 2px solid #ddd; border-top-color: #000; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.5; } }

#export-edit-modal .modal-box { max-width: 95vw; width: 1400px; height: 90vh; }
#export-edit-textarea { flex: 1; min-height: 60vh; resize: none; font-size: 15px; padding: 25px; border-radius: 12px; border: 2px solid #EBECEF; background: #FAFAFA; box-shadow: inset 0 2px 10px rgba(0,0,0,0.02); outline: none; transition: 0.3s; font-family: inherit; line-height: 1.6;}
#export-edit-textarea:focus { border-color: #C5A880; background: #fff; }

/* [ARCHITECT-Ω]: 赞助商点击区域全域包裹修复 */
#ad-container { display: none; margin: 20px auto; max-width: 85%; background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%); color: #333; border-radius: 16px; box-shadow: 0 8px 20px rgba(0,0,0,0.06); cursor: pointer; transition: all 0.3s ease; text-align: center; border: 1px solid #e9ecef; overflow: hidden; }
#ad-container a { text-decoration: none; color: inherit; display: block; padding: 20px; width: 100%; height: 100%; box-sizing: border-box; }
#ad-container:hover { transform: translateY(-3px); box-shadow: 0 12px 25px rgba(0,0,0,0.1); border-color: #d0d7de; }
.ad-badge { display: inline-block; background: #fdf0c6; color: #b8860b; font-size: 11px; padding: 4px 10px; border-radius: 6px; margin-bottom: 10px; font-weight: bold; letter-spacing: 1px; }
.ad-action { font-size: 13px; color: #2980b9; font-weight: bold; display: inline-block; padding: 6px 15px; border-radius: 20px; border: 1px solid #2980b9; transition: 0.2s; margin-top: 5px;}
#ad-container:hover .ad-action { background: #2980b9; color: #fff; }

#prompt-intro-banner { display: none; padding: 10px 30px 10px 15px; background: #f0f7ff; color: #2980b9; font-size: 12px; font-weight: 600; margin: 0 20px 10px 20px; border-radius: 8px; border: 1px solid #d0e3f5; box-shadow: 0 4px 12px rgba(0,0,0,0.02); z-index: 5; position: relative; }
#guest-upgrade-bar { display: none; background: linear-gradient(90deg, #1e3c72 0%, #2a5298 100%); color: #fff; text-align: center; padding: 12px; font-size: 13px; font-weight: bold; cursor: pointer; transition: 0.2s; }
#guest-upgrade-bar:hover { opacity: 0.9; }

.input-box { width: 100%; max-width: 800px; margin: 0 auto; background: #f4f4f7; border-radius: 24px; display: flex; align-items: flex-end; padding: 8px 12px; gap: 8px; border: 1px solid transparent; transition: 0.3s; }
.input-box:focus-within { border-color: #ddd; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
textarea { flex: 1; border: none; background: transparent; padding: 10px 5px; font-size: 15px; max-height: 150px; resize: none; outline: none; line-height: 1.5; font-family: inherit;}

#send-btn { 
    width: 40px; height: 40px; 
    background: linear-gradient(135deg, #2b2b2b 0%, #000000 100%); 
    color: #fff; border: none; border-radius: 50%; 
    cursor: pointer; display: flex; align-items: center; justify-content: center; 
    flex-shrink: 0; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); border: 1px solid rgba(255,255,255,0.1);
}
#send-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.25); }
#send-btn:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
#send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.icon-send { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: 0.3s; }
.icon-stop { fill: currentColor; transition: 0.3s; }

.blink-cursor { display: inline-block; width: 8px; height: 1.2em; background-color: #888; vertical-align: middle; animation: blink 1s step-end infinite; margin-left: 2px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 3000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px); padding: 15px; }
.modal-box { background: #fff; width: 100%; max-width: 400px; border-radius: 20px; padding: 25px; display: flex; flex-direction: column; gap: 15px; max-height: 90vh; overflow-y: auto;}
.modal-box input, .modal-box textarea, .modal-box select { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 10px; box-sizing: border-box; outline: none; font-family: inherit;}

.btn-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }
.btn-main { background: #000; color: #fff; border: none; padding: 10px 20px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.btn-sub { background: #f0f0f0; border: none; padding: 10px 20px; border-radius: 10px; cursor: pointer; }

.wf-node { display: flex; align-items: center; gap: 10px; background: #f8f9fa; padding: 10px; border-radius: 10px; border: 1px solid #eee; margin-bottom: 5px;}
.wf-node select { flex: 1; padding: 8px; border-radius: 6px; border: 1px solid #ddd; outline: none; background: #fff; }

@media (max-width: 768px) { 
    aside { position: fixed; transform: translateX(-100%); } 
    aside.open { transform: translateX(0); box-shadow: 10px 0 30px rgba(0,0,0,0.1); } 
    #sidebar-overlay.open { display: block; } 
    .history-item .actions { display: flex; opacity: 0.8; }
    .msg-footer { opacity: 1; flex-wrap: wrap;}
    #chat-container { padding: 12px; gap: 16px; }
    .wrap-user { max-width: 95%; }
    .wrap-user .message { padding: 10px 14px; }
    .wrap-ai .message { padding: 2px 10px; border-left-width: 2px; }
    pre { padding: 12px; margin: 6px 0; }
    #prompt-intro-banner { margin: 0 10px 10px 10px; font-size: 11px;}
    #export-edit-modal .modal-box { width: 98vw; height: 95vh; padding: 15px; }
}
#gem-sidebar-list::-webkit-scrollbar, #wf-sidebar-list::-webkit-scrollbar, #rag-list::-webkit-scrollbar { width: 4px; }
#gem-sidebar-list::-webkit-scrollbar-thumb, #wf-sidebar-list::-webkit-scrollbar-thumb, #rag-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }
#history-list::-webkit-scrollbar { width: 0; }
textarea::-webkit-scrollbar { width: 0; }