/* style.css - Compact Density v17 (Removed unnecessary spacing) */

:root {
--bg-color: #131314;
--sidebar-bg: #1e1f20;
--text-color: #e3e3e3;
--input-bg: #282a2c;
--accent-color: #4c8df6;
--border-color: #444746;
--user-msg-bg: #303134;
--header-height: 60px;
--ai-msg-text: #e3e3e3;
--code-bg: #0d0d0d;
--shadow-color: rgba(0,0,0,0.5);
--heading-color: #a8c7fa;
}

[data-theme="light"] {
--bg-color: #ffffff;
--sidebar-bg: #f0f4f9;
--text-color: #1f1f1f;
--input-bg: #f0f4f9;
--accent-color: #188038;
--border-color: #e0e0e0;
--user-msg-bg: #e3e3e3;
--header-height: 60px;
--ai-msg-text: #1f1f1f;
--code-bg: #1e1f20;
--shadow-color: rgba(0,0,0,0.1);
--heading-color: #0d652d;
}

[data-theme="green"] {
--bg-color: #0d1b14;
--sidebar-bg: #15291f;
--text-color: #e0f2e9;
--input-bg: #1a3326;
--accent-color: #4caf50;
--border-color: #2e523e;
--user-msg-bg: #1f3d2e;
--header-height: 60px;
--ai-msg-text: #e0f2e9;
--code-bg: #0a140f;
--shadow-color: rgba(0,0,0,0.5);
--heading-color: #81c784;
}

[data-theme="red"] {
--bg-color: #1b0d0d;
--sidebar-bg: #291515;
--text-color: #f2e0e0;
--input-bg: #331a1a;
--accent-color: #f44336;
--border-color: #522e2e;
--user-msg-bg: #3d1f1f;
--header-height: 60px;
--ai-msg-text: #f2e0e0;
--code-bg: #140a0a;
--shadow-color: rgba(0,0,0,0.5);
--heading-color: #e57373;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
input, textarea, select, button { font-family: inherit; }

html {
background-color: var(--bg-color) !important;
width: 100%;
height: 100dvh;
margin: 0;
padding: 0;
overflow: hidden;
overscroll-behavior: none;
}

body {
background-color: var(--bg-color) !important;
font-family: 'Google Sans', Roboto, sans-serif;
color: var(--text-color);
display: flex;
width: 100%;
height: 100dvh;
margin: 0;
padding: 0;
overflow: hidden;
overscroll-behavior: none;
transition: background-color 0.3s, color 0.3s;
}

.material-symbols-rounded { vertical-align: middle; font-size: 24px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #555; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

.loader-container { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; width: 100%; min-height: 200px; animation: fadeIn 0.2s; flex: 1; }
.spinner { width: 36px; height: 36px; border: 3px solid rgba(128, 128, 128, 0.3); border-top-color: var(--accent-color); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 15px; }
.loading-text { font-size: 13px; color: var(--text-color); opacity: 0.6; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Sidebar & Header */
#sidebar { width: 280px; background-color: var(--sidebar-bg); display: flex; flex-direction: column; padding: 1rem; border-right: 1px solid var(--border-color); flex-shrink: 0; z-index: 500; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.close-sidebar-btn { display: none; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 10px; }
.new-project-btn { background-color: var(--input-bg); color: var(--text-color); padding: 10px 16px; border-radius: 20px; cursor: pointer; margin-bottom: 15px; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; transition: 0.2s; border: 1px solid transparent; }
.new-project-btn:active { transform: scale(0.98); }
[data-theme="light"] .new-project-btn { background-color: #dde3ea; }
.project-list { flex: 1; overflow-y: auto; padding-right: 5px; }
.project-list::-webkit-scrollbar { width: 6px; }
.project-list::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.project-list:hover::-webkit-scrollbar-thumb { background: rgba(128, 128, 128, 0.5); }
.project-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 8px; cursor: pointer; margin-bottom: 2px; font-size: 14px; color: var(--text-color); transition: background-color 0.1s; position: relative; }
.project-item:hover { background-color: rgba(128,128,128,0.1); }
.project-item.active { background-color: #004a77; color: #d3e3fd; font-weight: 600; }
[data-theme="light"] .project-item.active { background-color: #c2e7ff; color: #001d35; }
.menu-trigger { opacity: 0; padding: 4px; border-radius: 50%; color: inherit; z-index: 2; }
.project-item:hover .menu-trigger, .project-item.active .menu-trigger { opacity: 1; }
.menu-trigger:hover { background-color: rgba(255,255,255,0.2); }
.context-menu { position: absolute; right: 10px; top: 30px; background: var(--sidebar-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 4px 0; z-index: 1000; display: none; min-width: 100px; box-shadow: 0 4px 12px var(--shadow-color); }
.context-menu.show { display: block; }
.menu-option { padding: 8px 12px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.menu-option:hover { background: rgba(128,128,128,0.1); }
.sidebar-footer { margin-top: auto; padding-top: 15px; border-top: 1px solid var(--border-color); display: flex; justify-content: space-between; gap: 5px; }
.footer-btn { flex: 1; padding: 8px; border-radius: 8px; cursor: pointer; font-size: 12px; color: #888; text-align: center; display: flex; align-items: center; justify-content: center; gap: 4px; transition: 0.2s; white-space: nowrap; }
.footer-btn:hover { background: rgba(128,128,128,0.1); color: var(--text-color); }

/* Main Layout */
#main-container { flex: 1; display: flex; flex-direction: column; position: relative; height: 100%; min-width: 0; background-color: var(--bg-color); overflow-x: hidden; }
#mobile-header { display: none; position: fixed; top: 0; left: 0; width: 100%; height: var(--header-height); background-color: var(--bg-color); align-items: center; justify-content: space-between; padding: 0 16px; z-index: 400; border-bottom: 1px solid var(--border-color); color: var(--text-color); transition: background-color 0.3s; }
.icon-btn { background: none; border: none; color: var(--text-color); padding: 8px; cursor: pointer; }
.header-title { font-weight: 600; font-size: 18px; position: absolute; left: 50%; transform: translateX(-50%); }

/* Chat History */
#chat-history { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; scroll-behavior: auto; padding-bottom: 20px; width: 100%; overflow-x: hidden; }
#welcome-screen { display: flex; flex-direction: column; justify-content: center; height: 100%; max-width: 800px; margin: 0 auto; width: 100%; animation: fadeIn 0.5s; min-width: 0; }
.greeting-container { display: flex; flex-direction: column; align-items: center; width: 100%; }
.greeting-text { margin-bottom: 40px; width: 100%; text-align: center; }
.gradient-text { font-size: 3rem; font-weight: 500; line-height: 1.2; background: linear-gradient(90deg, #4c8df6, #e94235); -webkit-background-clip: text; -webkit-text-fill-color: transparent; display: inline-block; }
.sub-text { font-size: 3rem; line-height: 1.2; color: var(--text-color); opacity: 0.5; }
.suggestion-chips { display: flex; flex-wrap: wrap; gap: 10px; width: 100%; justify-content: center; }
.chip { background: var(--sidebar-bg); border: 1px solid var(--border-color); color: var(--text-color); padding: 12px 18px; border-radius: 12px; cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 8px; transition: 0.2s; white-space: nowrap; }
.chip:hover { background: rgba(128,128,128,0.1); border-color: var(--accent-color); }

/* Message Bubbles */
.message { display: flex; gap: 12px; line-height: 1.5; width: 100%; max-width: 800px; margin: 0 auto 15px auto; min-width: 0; }
.message.user { flex-direction: column; align-items: flex-end; gap: 4px; }
.user-actions-bar { display: flex; gap: 4px; opacity: 0; transition: opacity 0.2s; margin-right: 8px; }
.message.user:hover .user-actions-bar { opacity: 1; }
.message.user .msg-content {
background-color: var(--user-msg-bg);
border-radius: 18px 18px 4px 18px;
padding: 10px 18px;
max-width: 85%;
min-width: 0;
color: var(--text-color);
margin-left: auto;
overflow-wrap: anywhere;
word-break: break-word;
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.message.ai { flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; }
.ai-header-row { display: flex; align-items: center; gap: 8px; padding-left: 2px; }
.ai-avatar { width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, #4c8df6, #e94235); display: flex; align-items: center; justify-content: center; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); flex-shrink: 0; }
.ai-avatar.designer { background: linear-gradient(135deg, #e91e63, #9c27b0); }
.ai-avatar.qa { background: linear-gradient(135deg, #0f9d58, #8bc34a); }
.ai-avatar .material-symbols-rounded { font-size: 16px; }
.ai-name { font-size: 12px; font-weight: bold; color: var(--text-color); opacity: 0.9; }
.ai-content-wrapper { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 100%; min-width: 0; }

/* Ultra-Compact AI Bubble Style */
.ai-bubble {
background-color: var(--sidebar-bg);
border: 1px solid var(--border-color);
border-radius: 4px 16px 16px 16px;
padding: 12px 16px;
color: var(--ai-msg-text);
box-shadow: 0 1px 2px rgba(0,0,0,0.1);
max-width: 100%;
box-sizing: border-box;
font-size: 14px;
line-height: 1.4;
white-space: normal;
overflow-wrap: anywhere;
word-break: break-word;
}

.ai-bubble > *:first-child { margin-top: 0; }
.ai-bubble > *:last-child { margin-bottom: 0; }

.ai-bubble h1, .ai-bubble h2, .ai-bubble h3 { margin: 10px 0 4px 0; font-weight: 700; color: var(--heading-color); line-height: 1.2; }
.ai-bubble h1 { font-size: 1.2em; border-bottom: 1px solid var(--border-color); padding-bottom: 4px; }
.ai-bubble h2 { font-size: 1.1em; }
.ai-bubble h3 { font-size: 1.0em; }
.message.ai.designer .ai-bubble { border-color: #e91e63; background-color: rgba(233, 30, 99, 0.05); }
.ai-bubble p { margin: 4px 0; }
.ai-bubble ul, .ai-bubble ol { margin: 4px 0; padding-left: 20px; }
.ai-bubble li { margin-bottom: 1px; line-height: 1.4; }
.ai-bubble li p { margin: 0; display: inline; }
.ai-bubble strong { font-weight: 700; color: var(--text-color); }
.ai-bubble hr { margin: 8px 0; border: none; border-top: 1px solid var(--border-color); }
.ai-bubble blockquote { margin: 6px 0; padding: 8px 10px; background: rgba(128, 128, 128, 0.05); border-radius: 0 8px 8px 0; border-left: 3px solid var(--accent-color); color: var(--text-color); opacity: 0.9; font-style: normal; }

/* 일반 대화창 내 코드 블록(pre) 가로 스크롤 허용 처리 */
.ai-bubble pre {
  white-space: pre;
  word-wrap: normal;
  word-break: normal;
  overflow-wrap: normal;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 8px;
}

/* Code Blocks */
.code-block-container { margin: 0; border: 1px solid #333; border-radius: 8px; background: var(--code-bg); font-family: 'Consolas', monospace; width: 100%; max-width: 100%; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.2); flex-shrink: 0; }
.code-header { background: #1e1f20; padding: 4px 10px; display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: #e3e3e3; border-bottom: 1px solid #333; position: sticky; top: 0; z-index: 10; height: 32px; }
.copy-code-btn { background: transparent; border: none; color: #a8c7fa; cursor: pointer; padding: 4px; display: flex; align-items: center; justify-content: center; border-radius: 4px; }
.copy-code-btn:hover { background: rgba(255,255,255,0.1); }
.copy-code-btn .material-symbols-rounded { font-size: 16px; }
.code-content { padding: 10px; margin: 0; overflow-x: auto; overflow-y: hidden; color: #76d275; font-size: 12px; line-height: 1.4; white-space: pre; background-color: var(--code-bg); }
.code-content::-webkit-scrollbar { height: 6px; background: transparent; }
.code-content::-webkit-scrollbar-thumb { background: transparent; border-radius: 3px; }
.code-block-container:hover .code-content::-webkit-scrollbar-thumb { background: #555; }

/* AI Action Buttons */
.ai-actions-bar { display: flex; gap: 4px; padding-top: 4px; align-self: flex-start; opacity: 0; transition: opacity 0.2s; }
.message.ai:hover .ai-actions-bar { opacity: 1; }
.action-icon-btn { background: transparent; border: none; color: #888; cursor: pointer; padding: 4px; border-radius: 4px; display: flex; align-items: center; justify-content: center; transition: 0.2s; position: relative; }
.action-icon-btn:hover { background: rgba(128,128,128,0.1); color: var(--text-color); }
.action-icon-btn .material-symbols-rounded { font-size: 16px; }
.tool-btn.active { color: var(--accent-color); opacity: 1; }
.tool-btn#directCoderBtn.active { color: #ffb300; opacity: 1; }
.tool-btn#emergencyBtn.active { color: #ff5252; opacity: 1; }
.tooltip { position: relative; }
.tooltip::after { content: attr(data-tooltip); position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%); background: #000; color: #fff; padding: 5px 8px; border-radius: 4px; font-size: 11px; white-space: nowrap; opacity: 0; pointer-events: none; transition: 0.2s; z-index: 100; box-shadow: 0 2px 5px rgba(0,0,0,0.3); }
.tooltip:hover::after { opacity: 1; bottom: 125%; }

/* Floating Panels Wrapper (직전 명령 & 메모장) */
#right-floating-container { position: absolute; top: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 450; max-height: calc(100vh - 120px); pointer-events: none; }
.floating-panel { width: 300px; max-height: 40vh; background-color: var(--sidebar-bg); border: 1px solid var(--border-color); border-radius: 12px; box-shadow: 0 8px 24px var(--shadow-color); display: flex; flex-direction: column; overflow: hidden; animation: fadeIn 0.2s ease-out; pointer-events: auto; flex-shrink: 0; }
.panel-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border-color); background: rgba(128,128,128,0.05); }
.panel-header h3 { margin: 0; font-size: 13px; display: flex; align-items: center; gap: 6px; color: var(--text-color); font-weight: 600; }
.panel-content { padding: 12px; overflow-y: auto; font-size: 12px; line-height: 1.5; color: var(--text-color); opacity: 0.9; white-space: pre-wrap; word-break: break-word; }

#memo-panel, #wasm-panel { height: 250px; }
#project-memo-input { flex: 1; width: 100%; border: none; background: transparent; color: var(--text-color); font-size: 13px; padding: 12px; resize: none; outline: none; line-height: 1.5; font-family: inherit; overflow-y: auto; }
#project-memo-input::placeholder { color: #888; }

/* Input Area */
#input-area { background: var(--bg-color); padding: 8px 12px; border-top: 1px solid transparent; width: 100%; z-index: 400; transition: background-color 0.3s; }
.input-wrapper { background: var(--input-bg); border-radius: 24px; padding: 12px 14px 10px 14px; display: flex; flex-direction: column; max-width: 800px; margin: 0 auto; position: relative; transition: all 0.2s; }
.input-wrapper:focus-within { box-shadow: 0 0 0 1px var(--border-color); }
.input-wrapper.expanded { border-radius: 16px; position: fixed; bottom: 0; left: 0; right: 0; top: 0; max-width: 100%; height: 100vh; padding: 20px; z-index: 2000; }

.send-container { position: absolute; bottom: 45px; right: 12px; z-index: 5; display: flex; align-items: center; justify-content: center; }
.input-wrapper.expanded .send-container { bottom: 24px; right: 24px; }
textarea { background: transparent; border: none; color: var(--text-color); font-size: 15px; padding: 4px 46px 5px 45px; width: 100%; resize: none; outline: none; min-height: 30px; max-height: 35vh; line-height: 1.4; overflow-y: hidden; }

.input-wrapper.expanded textarea { max-height: none; height: 100% !important; padding-left: 0; }
.input-wrapper.expanded .attach-container { display: none; }
.input-wrapper.expanded .voice-container { display: none; }
.input-wrapper.expanded .input-toolbar { margin-top: auto; padding-left: 0; }
.input-toolbar { display: flex; justify-content: space-between; align-items: center; padding-left: 45px; margin-top: 4px; }
.left-tools { display: flex; gap: 4px; align-items: center; flex: 1; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; -ms-overflow-style: none; }
.left-tools::-webkit-scrollbar { display: none; }
.right-tools { display: flex; gap: 6px; align-items: center; flex-shrink: 0; padding-left: 6px; }
.tool-btn { background: none; border: none; color: var(--text-color); opacity: 0.6; cursor: pointer; padding: 5px; border-radius: 50%; transition: 0.2s; flex-shrink: 0; }
.tool-btn:hover { opacity: 1; background: rgba(128,128,128,0.1); }
.send-btn { background: var(--text-color); color: var(--bg-color); border: none; border-radius: 50%; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.send-btn:hover { transform: scale(1.05); }

#file-preview-container { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 8px 14px; max-height: 120px; overflow-y: auto; max-width: 800px; margin: 0 auto; }
.preview-item { position: relative; width: 50px; height: 50px; border-radius: 6px; overflow: hidden; background-color: var(--sidebar-bg); border: 1px solid var(--border-color); flex-shrink: 0; transition: transform 0.1s; display: flex; align-items: center; justify-content: center; }
.preview-item img, .preview-item video, .preview-item embed { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.preview-text-content { width: 100%; height: 100%; padding: 4px; font-size: 6px; background-color: #fff; color: #000; overflow: hidden; white-space: pre-wrap; font-family: monospace; line-height: 1.2; text-align: left; border: none; }
.preview-item.doc-item { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px; background-color: var(--sidebar-bg); }
.preview-item .doc-ext { font-size: 9px; font-weight: bold; color: var(--text-color); text-transform: uppercase; margin-top: 1px; opacity: 0.8; }
.preview-remove { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; cursor: pointer; z-index: 10; }
.preview-item:hover .preview-remove { opacity: 1; }
.remove-icon { color: #fff; background: rgba(255, 255, 255, 0.2); border-radius: 50%; padding: 2px; font-size: 16px; }
.attach-container { position: absolute; bottom: 12px; left: 12px; z-index: 5; }
.attach-btn { width: 30px; height: 30px; border-radius: 50%; background: rgba(128,128,128,0.15); border: none; color: var(--text-color); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }
.attach-btn:hover { background: rgba(128,128,128,0.3); }
.voice-container { position: absolute; top: 12px; left: 12px; z-index: 5; }
.voice-btn { width: 30px; height: 30px; border-radius: 50%; background: rgba(128,128,128,0.15); border: none; color: var(--text-color); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }
.voice-btn:hover { background: rgba(128,128,128,0.3); }
.voice-btn.listening { background-color: #e94235; color: white; animation: pulse 1.5s infinite; }

.attach-menu { position: absolute; bottom: 45px; left: 0; background: var(--sidebar-bg); border: 1px solid var(--border-color); border-radius: 12px; width: 240px; display: none; box-shadow: 0 8px 24px rgba(0,0,0,0.4); z-index: 600; color: var(--text-color); padding: 5px; }
.attach-menu.show { display: block; animation: fadeIn 0.1s ease-out; }
.attach-option { padding: 8px 10px; font-size: 12px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 8px; border-radius: 6px; transition: 0.2s; color: var(--text-color); }
.attach-option:hover { background: rgba(128,128,128,0.1); }
.attach-option .material-symbols-rounded { font-size: 18px; opacity: 0.8; }

/* Query Mode Panel */
#query-panel { position: absolute; top: 0; right: 0; width: 400px; max-width: 100%; height: 100%; background-color: var(--sidebar-bg); border-left: 1px solid var(--border-color); display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 450; box-shadow: -4px 0 15px rgba(0,0,0,0.3); }
#query-panel.open { transform: translateX(0); }
@media (max-width: 768px) { 
#query-panel { top: var(--header-height); height: calc(100% - var(--header-height)); }
#right-floating-container { top: 10px; right: 10px; left: 10px; width: auto; pointer-events: none; }
.floating-panel { width: 100%; max-height: 25vh; pointer-events: auto; }
#memo-panel { height: 30vh; }
}
.query-header { display: flex; justify-content: space-between; align-items: center; padding: 15px; border-bottom: 1px solid var(--border-color); }
.query-header h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 8px; color: var(--heading-color); }
.query-chat-history { flex: 1; padding: 15px; padding-bottom: 40px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.query-input-area { padding: 12px; border-top: 1px solid var(--border-color); display: flex; gap: 8px; align-items: flex-end; background: var(--input-bg); }
.query-input-area textarea { flex: 1; background: transparent; border: none; color: var(--text-color); font-size: 14px; resize: none; outline: none; max-height: 150px; padding: 8px; }

/* 전지전능 창 좌측 툴팁 잘림 방지 */
.query-chat-history .ai-actions-bar .tooltip:first-child::after,
.query-chat-history .user-actions-bar .tooltip:first-child::after {
  left: 0;
  transform: translateX(0);
}

/* Modals */
#sidebar-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 450; display: none; backdrop-filter: blur(2px); }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 3000; display: none; justify-content: center; align-items: center; backdrop-filter: blur(3px); }
.modal-content { background: var(--sidebar-bg); width: 80%; height: 85%; border-radius: 16px; padding: 24px; display: flex; flex-direction: column; border: 1px solid var(--border-color); box-shadow: 0 20px 50px rgba(0,0,0,0.5); max-width: 800px; margin: 0 auto; }
.modal-content.small { width: 400px; max-width: 90%; height: auto; padding: 20px; }
.modal-header { display: flex; justify-content: space-between; margin-bottom: 16px; align-items: center; }
#new-project-modal .modal-content { width: 400px; max-width: 90%; }
#new-project-input { width: 100%; padding: 12px; margin-bottom: 20px; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 8px; color: var(--text-color); font-size: 14px; outline: none; }
#new-project-input:focus { border-color: var(--accent-color); }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; }
.modal-btn { padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; border: none; transition: 0.2s; }
.modal-btn.cancel { background: transparent; color: var(--text-color); border: 1px solid var(--border-color); }
.modal-btn.confirm { background: var(--accent-color); color: white; }
.modal-btn:hover { opacity: 0.9; }

/* History & Version List */
.version-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 5px; margin-bottom: 15px; }
.history-item { background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 12px; display: flex; justify-content: space-between; align-items: center; transition: 0.2s; }
.history-item:hover { border-color: var(--accent-color); background: rgba(128,128,128,0.05); }
.history-info { display: flex; flex-direction: column; gap: 4px; overflow: hidden; flex: 1; }
.history-ver { font-weight: bold; color: var(--accent-color); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.history-summary { font-size: 12px; color: var(--text-color); opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-meta { font-size: 10px; color: #777; }
.history-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.hist-btn { background: var(--sidebar-bg); border: 1px solid var(--border-color); color: var(--text-color); width: 28px; height: 28px; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }
.hist-btn:hover { background: var(--accent-color); color: white; border-color: var(--accent-color); }
.status-wrapper { position: relative; display: flex; align-items: center; }
.status-select { background-color: var(--sidebar-bg); color: var(--text-color); border: 1px solid var(--border-color); border-radius: 6px; padding: 4px 6px; font-size: 11px; cursor: pointer; outline: none; transition: 0.2s; }
.status-select:hover { border-color: var(--accent-color); }
.status-select option { background-color: var(--sidebar-bg); color: var(--text-color); }

/* Code Preview Container */
.code-preview-container { flex: 1; background: var(--bg-color); padding: 10px; border-radius: 8px; overflow-y: auto; border: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 15px; }
.modal-actions { margin-top: 16px; display: flex; gap: 10px; justify-content: flex-end; }
.action-btn { padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; font-weight: 600; }
.action-btn.delete { background: #592424; color: #ffb4ab; }
.setting-item { padding: 10px; border-radius: 8px; cursor: pointer; margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.setting-item:hover { background: rgba(128,128,128,0.1); }
.activity-list { flex: 1; overflow-y: auto; padding-right: 5px; }
.activity-item { padding: 8px; border-bottom: 1px solid var(--border-color); font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.activity-item:last-child { border-bottom: none; }
.act-date { font-size: 10px; color: #888; }
.act-content { color: var(--text-color); font-weight: 500; }
.act-proj { font-size: 10px; color: var(--accent-color); }

/* Queue & Mobile */
#queue-display-area { width: 100%; max-width: 800px; margin: 0 auto; padding: 0 16px; display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.queue-item { background-color: var(--sidebar-bg); border: 1px solid var(--border-color); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--text-color); display: flex; align-items: center; justify-content: space-between; animation: fadeIn 0.2s ease-out; box-shadow: 0 1px 3px var(--shadow-color); transition: transform 0.2s, border-color 0.2s; cursor: pointer; }
.queue-item:hover { border-color: var(--accent-color); background-color: rgba(128, 128, 128, 0.05); }
.queue-content { display: flex; align-items: center; gap: 6px; flex: 1; overflow: hidden; }
.queue-badge { background: var(--accent-color); color: #fff; font-size: 9px; padding: 1px 4px; border-radius: 4px; font-weight: bold; white-space: nowrap; }
.queue-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90%; opacity: 0.9; }
.queue-remove-btn { background: transparent; border: none; color: #ff6b6b; cursor: pointer; padding: 2px; display: flex; align-items: center; justify-content: center; border-radius: 50%; opacity: 0; transition: opacity 0.2s, background-color 0.2s; }
.queue-item:hover .queue-remove-btn { opacity: 1; }
.queue-remove-btn:hover { background-color: rgba(255, 107, 107, 0.1); }

@media (max-width: 768px), (max-height: 500px) and (orientation: landscape) {
#mobile-header { display: flex; }
#main-container { padding-top: var(--header-height); }
.close-sidebar-btn { display: block; }
.sidebar-header { border-bottom: 1px solid var(--border-color); margin-bottom: 15px; padding-bottom: 15px; }
#sidebar { position: fixed; top: 0; left: 0; height: 100%; width: 280px; transform: translateX(-100%); z-index: 1000; box-shadow: 2px 0 20px rgba(0,0,0,0.5); }
#sidebar.open { transform: translateX(0); }
#sidebar-overlay.open { display: block; }
.gradient-text, .sub-text { font-size: 1.8rem; }
.input-wrapper { padding: 12px 10px 8px 10px; border-radius: 16px; }
textarea { padding-left: 42px; padding-right: 42px; font-size: 15px; min-height: 36px; padding-top: 8px; padding-bottom: 8px; }
.input-toolbar { padding-left: 42px; margin-top: 8px; }
.voice-container { top: auto; bottom: 50px; left: 10px; }
.send-container { bottom: 50px; right: 10px; }
.attach-container { bottom: 10px; left: 10px; }
.modal-content { width: 100%; height: 100%; border-radius: 0; border: none; padding: 16px; }
.modal-content.small { width: 90%; height: auto; border-radius: 12px; }
#new-project-modal .modal-content { width: 90%; height: auto; border-radius: 12px; }

/* 스마트폰 및 가로 모드 메인창/글씨/박스 최적화 */
#chat-history { padding: 12px 10px; gap: 10px; }
.ai-bubble { font-size: 13px; padding: 10px 14px; line-height: 1.4; }
.message.user .msg-content { font-size: 13px; padding: 8px 14px; }
.message { gap: 8px; margin-bottom: 10px; }
.code-header { font-size: 10px; height: 28px; padding: 2px 8px; }
.code-content { font-size: 11px; padding: 8px; }
.ai-avatar { width: 20px; height: 20px; }
.ai-avatar .material-symbols-rounded { font-size: 14px; }
.ai-name { font-size: 11px; }
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.token-cost-toast {
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.8);
color: #fff;
padding: 10px 20px;
border-radius: 20px;
font-size: 13px;
z-index: 99999;
pointer-events: auto;
display: flex;
align-items: center;
animation: toastSlideDown 0.3s ease;
transition: opacity 0.5s ease;
box-shadow: 0 4px 12px var(--shadow-color);
max-width: 90vw;
width: max-content;
box-sizing: border-box;
}
.token-cost-toast.fade-out {
opacity: 0;
}
@keyframes toastSlideDown {
from { opacity: 0; transform: translate(-50%, -20px); }
to { opacity: 1; transform: translate(-50%, 0); }
}

/* Update Popup */
.update-popup {
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%) translateY(0);
background-color: var(--sidebar-bg);
border: 1px solid var(--accent-color);
border-radius: 12px;
padding: 12px 20px;
box-shadow: 0 8px 24px rgba(0,0,0,0.6);
display: flex;
align-items: center;
gap: 20px;
z-index: 10000;
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
}
.update-popup.hidden {
transform: translateX(-50%) translateY(100px);
opacity: 0;
pointer-events: none;
}
.update-actions { display: flex; gap: 8px; }
.update-btn {
padding: 6px 12px;
border-radius: 6px;
border: none;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: 0.2s;
}
.update-btn.refresh { background-color: var(--accent-color); color: #fff; }
.update-btn.refresh:hover { opacity: 0.9; }
.update-btn.close { background-color: transparent; color: var(--text-color); border: 1px solid var(--border-color); }
.update-btn.close:hover { background-color: rgba(128,128,128,0.1); }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--border-color); transition: .4s; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .4s; }
input:checked + .slider { background-color: var(--accent-color); }
input:checked + .slider:before { transform: translateX(18px); }
.slider.round { border-radius: 22px; }
.slider.round:before { border-radius: 50%; }

/* Toast Message */
.toast-message {
position: fixed;
bottom: 80px;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.8);
color: #fff;
padding: 10px 20px;
border-radius: 20px;
font-size: 13px;
z-index: 99999;
pointer-events: auto;
cursor: pointer;
animation: toastFadeIn 0.3s ease;
transition: opacity 0.3s ease;
}
.toast-message.success {
background: rgba(76, 175, 80, 0.9);
border: 1px solid rgba(76, 175, 80, 0.3);
}
.toast-message.fade-out {
opacity: 0;
}
@keyframes toastFadeIn {
from { opacity: 0; transform: translate(-50%, 20px); }
to { opacity: 1; transform: translate(-50%, 0); }
}

.icon-ultron {
display: inline-block;
background: url("https://rsad.co.kr/download/Ultron2.png") no-repeat center / contain;
}

/* 사용자 말풍선 내 마크다운(코드블록, 인용구 등) 깨짐 방지 스타일 */
.message.user .msg-content > *:first-child { margin-top: 0; }
.message.user .msg-content > *:last-child { margin-bottom: 0; }
.message.user .msg-content pre {
  white-space: pre;
  word-wrap: normal;
  word-break: normal;
  overflow-wrap: normal;
  background: rgba(0,0,0,0.15);
  padding: 8px 12px;
  border-radius: 8px;
  font-family: 'Consolas', monospace;
  font-size: 13px;
  margin: 6px 0;
  overflow-x: auto;
  max-width: 100%;
}
.message.user .msg-content blockquote {
  margin: 6px 0;
  padding-left: 10px;
  border-left: 3px solid var(--accent-color);
  opacity: 0.8;
  font-style: italic;
}

/* 배포 시작 알림 툴팁 */
.deploy-tooltip {
  position: absolute;
  background: var(--accent-color);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: bold;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.3s ease;
}
.deploy-tooltip.pc {
  top: 6px;
  left: 15px;
  animation: tooltipBouncePc 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.deploy-tooltip.pc::after {
  content: '';
  position: absolute;
  top: -4px;
  left: 15px;
  border-width: 0 5px 5px 5px;
  border-style: solid;
  border-color: transparent transparent var(--accent-color) transparent;
}
.deploy-tooltip.mobile {
  bottom: 6px;
  left: 15px;
  animation: tooltipBounceMobile 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.deploy-tooltip.mobile::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 15px;
  border-width: 5px 5px 0 5px;
  border-style: solid;
  border-color: var(--accent-color) transparent transparent transparent;
}
@keyframes tooltipBouncePc {
  0% { transform: translateY(10px) scale(0.8); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes tooltipBounceMobile {
  0% { transform: translateY(10px) scale(0.8); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}