/* ---------- DeepSeek-Inspired Dark/Light/Cobalt/Stone ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Claude-inspired typography */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
}
.msg-content {
    font-size: 15px;
    line-height: 1.7;
    letter-spacing: -0.003em;
}
h1, h2, h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.3;
}
.chat-item, .sidebar-foot {
    font-size: 14px;
    letter-spacing: -0.005em;
}
textarea {
    font-family: inherit;
    font-size: 16px;
    line-height: 1.6;
    letter-spacing: -0.01em;
}

:root, body.dark {
  --bg: #0f0f0f;
  --bg2: #1a1a1a;
  --bg3: #222;
  --border: #2a2a2a;
  --fg: #ececec;
  --fg2: #9b9b9b;
  --fg3: #555;
  --accent: #4f8ff7;
  --accent-hover: #6ba3ff;
  --accent-dim: rgba(79,143,247,.15);
  --green: #238636;
  --green-hover: #2ea043;
  --red: #e5534b;
  --bubble-user: #1c3b5e;
  --bubble-assistant: var(--bg2);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-round: 24px;
  --msg-max: 720px;
  --shadow: 0 2px 12px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.4);
  --shadow-glow: 0 0 20px rgba(79,143,247,.08);
}
body.light {
  --bg: #f8f9fa;
  --bg2: #fff;
  --bg3: #f1f3f5;
  --border: #dee2e6;
  --fg: #212529;
  --fg2: #6c757d;
  --fg3: #adb5bd;
  --accent: #4f8ff7;
  --accent-hover: #3b7be0;
  --accent-dim: rgba(79,143,247,.1);
  --green: #2ea043;
  --green-hover: #238636;
  --red: #e5534b;
  --bubble-user: #dce9ff;
  --bubble-assistant: #fff;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
  --shadow-glow: 0 0 20px rgba(79,143,247,.06);
}
body.stone {
  --bg: #1e1b18;
  --bg2: #252220;
  --bg3: #2d2926;
  --border: #3a3530;
  --fg: #e6d9c4;
  --fg2: #9c8d7c;
  --fg3: #6b5f53;
  --accent: #c7925a;
  --accent-hover: #daa66b;
  --accent-dim: rgba(199,146,90,.15);
  --green: #7a5c3a;
  --green-hover: #8d6e4a;
  --red: #b04a3a;
  --bubble-user: #3b2e1e;
  --bubble-assistant: var(--bg2);
  --shadow: 0 2px 12px rgba(0,0,0,.35);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.45);
  --shadow-glow: 0 0 20px rgba(199,146,90,.08);
}
body.cobalt {
  --bg: #0d1b2a;
  --bg2: #14273d;
  --bg3: #1a3350;
  --border: #1f3d5c;
  --fg: #e0e7ff;
  --fg2: #7b8db0;
  --fg3: #4a6a8a;
  --accent: #4ea8de;
  --accent-hover: #6bbce8;
  --accent-dim: rgba(78,168,222,.15);
  --green: #1a6b4a;
  --green-hover: #23805a;
  --red: #b04a5a;
  --bubble-user: #1a3452;
  --bubble-assistant: var(--bg2);
  --shadow: 0 2px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.5);
  --shadow-glow: 0 0 20px rgba(78,168,222,.08);
}

/* Smooth spring + ease curves */
:root { --spring: cubic-bezier(.34,1.56,.64,1); --smooth: cubic-bezier(.22,1,.36,1); --bounce: cubic-bezier(.4,1.9,.6,1); }

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  overflow: hidden;
  transition: background .3s, color .3s;
  accent-color: var(--accent);
  animation: fadeIn .4s var(--smooth) both;
}



/* Thin scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; transition: background .2s; }
::-webkit-scrollbar-thumb:hover { background: var(--fg2); }
#result::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--accent), transparent 80%); opacity: .6; }
#result::-webkit-scrollbar-thumb:hover { opacity: 1; }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* ---------- Layout ---------- */
.app-layout { display: flex; height: 100vh; }
.main-panel { flex: 1; display: flex; flex-direction: column; max-width: var(--msg-max); margin: 0 auto; width: 100%; min-width: 0; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 270px; background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0;
  transition: transform .35s cubic-bezier(.4,0,.2,1), background .4s ease; z-index: 10;
}
.sidebar.collapsed { transform: translateX(-100%); position: fixed; height: 100%; top: 0; left: 0; }
.sidebar-head {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  transition: border-color .4s ease;
}
.logo {
  font-size: 17px; font-weight: 700; letter-spacing: -.3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: background .4s ease;
}
.new-chat-btn {
  background: var(--accent); color: #fff; border: none; border-radius: 8px;
  padding: 5px 12px; font-size: 13px; cursor: pointer; font-weight: 500;
  transition: transform .15s var(--spring), box-shadow .15s;
}
.new-chat-btn:hover { transform: scale(1.04); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.new-chat-btn:active { transform: scale(.96); }
.chat-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.chat-item {
  padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--fg2);
  transition: background .2s var(--smooth), transform .12s var(--spring);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative;
  animation: slideUp .2s cubic-bezier(.16,1,.3,1);
}
.chat-item:focus-visible { overflow: visible; outline-offset: -2px; }
.chat-item:hover { background: var(--bg3); color: var(--fg); transform: translateX(2px); }
.chat-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 500; }
.chat-item.active::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
  background: var(--accent); border-radius: 0 3px 3px 0;
}
.sidebar-foot {
  padding: 12px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
  transition: background .4s ease;
}
.prov-select {
  width: 100%; padding: 7px 10px; border-radius: 8px;
  background: var(--bg3); border: 1px solid var(--border); color: var(--fg); font-size: 13px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.prov-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.tool-toggle { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg2); cursor: pointer; user-select: none; }
.tool-toggle input { accent-color: var(--accent); }
.sidebar-btn {
  display: block; width: 100%; padding: 7px 10px; border-radius: 8px;
  background: transparent; border: 1px solid transparent; color: var(--fg2); font-size: 13px;
  cursor: pointer; text-align: left;
  transition: background .2s var(--smooth), color .2s, transform .15s cubic-bezier(.34,1.56,.64,1), border-color .2s;
}
.sidebar-btn:hover { background: var(--bg3); color: var(--fg); transform: translateX(3px); border-color: var(--border); }
.sidebar-btn:active { transform: translateX(0); }

/* ---------- Messages ---------- */
#result { flex: 1; overflow-y: auto; padding: 20px 16px; scroll-behavior: smooth; }
#result::before { content: ''; position: sticky; top: 0; left: 0; right: 0; height: 20px; background: linear-gradient(to bottom, var(--bg), transparent); z-index: 5; pointer-events: none; opacity: 0; transition: opacity .3s var(--smooth); margin-bottom: -20px; }
#result.scrolled::before { opacity: 1; }
.messages-inner { display: flex; flex-direction: column; gap: 16px; }

.msg-row { display: flex; gap: 8px; max-width: 85%; animation: msgIn .35s var(--smooth) both; }
.msg-row.msg-user { align-self: flex-end; flex-direction: row-reverse; animation: msgSlideUser .3s cubic-bezier(.16,1,.3,1); }
.msg-row.msg-assistant { align-self: flex-start; animation: msgSlide .3s cubic-bezier(.16,1,.3,1); }
.msg-row.msg-system { align-self: center; font-size: 12px; color: var(--fg2); max-width: 90%; text-align: center; animation: msgIn .25s ease-out; }

/* Stagger entrance for multiple messages */
.msg-row:nth-child(2) { animation-delay: .05s; }
.msg-row:nth-child(3) { animation-delay: .1s; }
.msg-row:nth-child(4) { animation-delay: .15s; }

.msg-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  transition: transform .2s var(--spring);
}
.msg-row:hover .msg-avatar { transform: scale(1.1); }
.msg-user .msg-avatar { background: var(--accent); color: #fff; }
.msg-assistant .msg-avatar { background: var(--bg3); color: var(--fg); }

.msg-bubble {
  background: var(--bubble-assistant); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: var(--radius); position: relative;
  font-size: 14px; line-height: 1.6; min-width: 0;
  transition: box-shadow .25s var(--smooth), border-color .25s var(--smooth), transform .2s var(--spring);
}
.msg-bubble:hover {
  box-shadow: var(--shadow-glow), 0 2px 8px rgba(0,0,0,.08);
  transform: translateY(-1px);
}
.msg-assistant .msg-bubble:hover { border-color: var(--accent-dim); }
.msg-user .msg-bubble { background: var(--bubble-user); border-color: var(--accent); }
.msg-user .msg-bubble:hover { transform: translateY(-1px); }
.msg-content { word-wrap: break-word; }
.msg-content p { margin-bottom: 8px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content code {
  background: var(--bg); padding: 2px 5px; border-radius: 4px; font-size: 13px;
  font-family: "Fira Code","Cascadia Code",Consolas,monospace;
}
.msg-content pre {
  background: var(--bg); padding: 14px; border-radius: 8px; overflow-x: auto; margin: 10px 0;
  font-size: 13px; position: relative; border: 1px solid var(--border);
  transition: border-color .2s;
}
.msg-content pre:hover { border-color: var(--accent-dim); }
.msg-content pre::before {
  content: attr(class); position: absolute; top: 6px; right: 8px;
  font-size: 10px; color: var(--fg2); opacity: .5; text-transform: uppercase;
  letter-spacing: .5px; font-family: inherit;
  pointer-events: none;
}
.msg-content pre[class*="lang-"]::before {
  content: attr(class); opacity: .6;
}
.msg-content pre code { position: relative; z-index: 1; }
.msg-content details.code-fold { margin: 8px 0; }
.msg-content details.code-fold summary {
  cursor: pointer; font-size: 12px; color: var(--accent); padding: 4px 8px;
  background: var(--bg3); border-radius: 6px; display: inline-block; user-select: none;
  transition: background .15s;
}
.msg-content details.code-fold summary:hover { background: var(--border); }
.msg-content details.code-fold pre { margin: 4px 0 0; }
.msg-content a {
  color: var(--accent); text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 0% 100%; background-repeat: no-repeat;
  background-size: 0% 1px; transition: background-size .25s cubic-bezier(.4,0,.2,1);
  padding-bottom: 1px;
}
.msg-content a:hover { background-size: 100% 1px; }
.msg-content ul, .msg-content ol { padding-left: 20px; margin: 6px 0; }
.msg-content blockquote { border-left: 3px solid var(--border); padding-left: 12px; color: var(--fg2); margin: 8px 0; }
.msg-content img { max-width: 100%; border-radius: 8px; margin: 4px 0; }

/* Timestamp on hover */
.msg-bubble .timestamp {
  opacity: 0; font-size: 11px; color: var(--fg2);
  margin-top: 4px; transition: opacity .2s var(--smooth);
}
.msg-bubble:hover .timestamp { opacity: 1; }

/* Hover actions - slide in from right */
.msg-bubble .copy-btn, .msg-bubble .tts-btn, .feedback-wrap, .edit-btn, .bookmark-btn {
  opacity: 0; transform: translateX(-4px); transition: opacity .15s var(--smooth), transform .15s var(--smooth);
}
.msg-bubble:hover .copy-btn, .msg-bubble:hover .tts-btn, .msg-bubble:hover .feedback-wrap,
.msg-bubble:hover .edit-btn, .msg-bubble:hover .bookmark-btn { opacity: 1; transform: translateX(0); }
.copy-btn, .tts-btn {
  background: var(--bg3); border: 1px solid var(--border); color: var(--fg2);
  padding: 3px 8px; border-radius: 5px; cursor: pointer; font-size: 11px; margin-right: 4px;
  transition: background .15s, color .15s, transform .1s var(--spring); vertical-align: middle;
}
.copy-btn:hover, .tts-btn:hover { color: var(--fg); background: var(--border); transform: scale(1.04); }
.copy-btn:active, .tts-btn:active { transform: scale(.95); }
.tts-btn.speaking { background: var(--green); border-color: var(--green-hover); color: #fff; }
.feedback-wrap { display: inline-flex; gap: 2px; vertical-align: middle; }
.feedback-wrap button { background: none; border: none; cursor: pointer; font-size: 13px; padding: 2px 3px; opacity: .5; transition: opacity .15s, transform .15s var(--spring); line-height: 1; }
.feedback-wrap button:hover { opacity: 1; transform: scale(1.2); }

/* Tool badge */
.tool-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--accent); background: var(--accent-glow); padding: 3px 10px; border-radius: 6px; transition: background .2s; }
.tool-badge.tool-running { animation: toolPulse 1.6s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toolPulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
.spin { display: inline-block; animation: spin 1s linear infinite; }

/* Typing indicator */
.typing-bounce { display: flex; gap: 6px; padding: 8px 0; align-items: center; }
.typing-bounce span {
  width: 7px; height: 7px; background: var(--accent); border-radius: 50%;
  animation: bounce 1.5s infinite ease-in-out both;
}
.typing-bounce span:nth-child(1) { animation-delay: -.32s; }
.typing-bounce span:nth-child(2) { animation-delay: -.16s; }
.typing-bounce span:nth-child(3) { animation-delay: 0s; }

/* ---------- Input ---------- */
.input-area {
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  position: relative;
  animation: inputSlideUp .4s var(--smooth) both;
}
@keyframes inputSlideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.input-row { display: flex; align-items: center; gap: 6px; }
.input-btn-group { position: relative; flex-shrink: 0; }

/* Animated gradient border glow when focused */
.input-wrap {
  display: flex; align-items: center; gap: 6px; flex: 1;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-round);
  padding: 6px 6px 6px 20px;
  position: relative;
  transition: border-color .2s var(--smooth), box-shadow .2s var(--smooth);
}
.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim), 0 0 0 5px rgba(79,143,247,.05);
}
.input-wrap:focus-within textarea { animation: glowPulse 2.5s ease-in-out infinite; }
@keyframes glowPulse { 0%, 100% { text-shadow: 0 0 0 transparent; } 50% { text-shadow: 0 0 4px var(--accent-dim); } }
.input-wrap textarea {
  flex: 1; border: none; background: transparent; color: var(--fg); resize: none;
  font-size: 16px; line-height: 1.6; padding: 10px 0; outline: none; max-height: 200px;
  font-family: inherit; min-height: 28px;
}
.input-wrap textarea::placeholder { color: var(--fg2); font-size: 15px; }

.mic-btn, .upload-btn {
  background: none; border: none; color: var(--fg2); font-size: 20px; padding: 8px 10px;
  cursor: pointer; border-radius: 8px;
  transition: color .15s, background .15s, transform .12s var(--spring); flex-shrink: 0;
}
.mic-btn:hover, .upload-btn:hover { color: var(--fg); background: var(--bg3); transform: scale(1.1); }
.mic-btn:active, .upload-btn:active { transform: scale(.92); }
.mic-btn.listening { color: var(--red); animation: pulse 1s infinite; }

.send-btn {
  background: linear-gradient(135deg, var(--accent), #6c63ff); color: #fff; border: none;
  border-radius: 50%; width: 44px; height: 44px; font-size: 16px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s var(--spring), opacity .2s, box-shadow .2s;
}
.send-btn.active { animation: popIn .3s var(--spring); }
@keyframes popIn { 0% { transform: scale(.85); opacity: .7; } 50% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.send-btn:hover { transform: scale(1.08); box-shadow: 0 2px 16px rgba(79,143,247,.35); }
.send-btn:active { transform: scale(.92); }
.send-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.stop-btn {
  background: var(--red); color: #fff; border: none; border-radius: 50%;
  width: 44px; height: 44px; font-size: 16px; cursor: pointer; flex-shrink: 0;
  display: none; align-items: center; justify-content: center;
  transition: transform .12s var(--spring), opacity .2s;
}
.stop-btn:hover { transform: scale(1.08); }
.stop-btn:active { transform: scale(.92); }
.regenerate-btn {
  background: var(--bg3); color: var(--fg); border: 1px solid var(--border); border-radius: 50%;
  width: 44px; height: 44px; font-size: 16px; cursor: pointer; flex-shrink: 0;
  display: none; align-items: center; justify-content: center;
  transition: background .15s, transform .12s var(--spring);
}
.regenerate-btn:hover { background: var(--border); transform: rotate(180deg); }
.regenerate-btn:active { transform: rotate(180deg) scale(.92); }

/* File cards */
.file-cards { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 0 6px; }
.file-card {
  display: flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 6px;
  background: var(--bg2); border: 1px solid var(--border); font-size: 12px; color: var(--fg2);
  animation: msgIn .25s var(--smooth) both;
}
.file-card .file-remove { cursor: pointer; font-size: 14px; color: var(--red); background: none; border: none; padding: 0 0 0 4px; opacity: .7; transition: opacity .15s, transform .1s var(--spring); }
.file-card .file-remove:hover { opacity: 1; transform: scale(1.15); }

/* Status */
.status-bar {
  padding: 4px 16px 8px; font-size: 12px; color: var(--fg2);
  min-height: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.status-dot { display: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: glow 1.5s ease-in-out infinite; flex-shrink: 0; }
.status-bar:has(#status-text:not(:empty)) .status-dot { display: inline-block; }
.status-bar.active .status-dot { display: inline-block; }
.welcome p { color: var(--fg2); margin-bottom: 24px; font-size: 14px; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.examples button {
  background: var(--bg2); border: 1px solid var(--border); padding: 8px 18px; border-radius: 20px;
  cursor: pointer; font-size: 14px; color: var(--fg2);
  transition: background .15s, color .15s, transform .12s var(--spring), border-color .15s;
}
.examples button:hover { background: var(--bg3); color: var(--fg); transform: translateY(-1px); border-color: var(--accent); }
.examples button:active { transform: translateY(0); }

/* ---------- Sidebar toggle ---------- */
.sidebar-toggle {
  position: fixed; top: 10px; left: 12px; z-index: 15;
  background: var(--bg2); border: 1px solid var(--border); color: var(--fg);
  font-size: 18px; width: 34px; height: 34px; border-radius: 8px;
  cursor: pointer; display: none; align-items: center; justify-content: center;
  transition: background .15s, transform .1s var(--spring), box-shadow .15s;
}
.sidebar-toggle:hover { background: var(--bg3); transform: scale(1.06); }
.collapsed ~ .main-panel .sidebar-toggle { display: flex; }
@media (max-width: 640px) {
  .sidebar-toggle { display: flex; }
  .sidebar.collapsed { transform: translateX(-100%); position: fixed; top: 0; left: 0; height: 100%; }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open::before {
    content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.4);
    backdrop-filter: blur(2px); z-index: -1; animation: fadeIn .2s ease;
  }
  .msg-row { max-width: 95%; }
  .input-area { padding: 8px 8px 12px; }
  #result { padding: 12px 8px; }
}

/* ---------- Dialogs ---------- */
.dialog-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100;
  display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}
.dialog-overlay.open { display: flex; }
.dialog {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; max-width: 420px; width: 90%; max-height: 80vh; overflow-y: auto;
  animation: dialogIn .3s var(--spring) both;
  box-shadow: var(--shadow-lg);
}
.dialog h3 { font-size: 16px; font-weight: 600; }
.dialog-input {
  width: 100%; padding: 8px 10px; border-radius: 8px; background: var(--bg3);
  border: 1px solid var(--border); color: var(--fg); font-size: 14px;
  font-family: inherit; resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.dialog-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.dialog-btn {
  padding: 7px 16px; border-radius: 8px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500;
  transition: transform .1s var(--spring), opacity .15s, background .15s;
}
.dialog-btn:hover { transform: scale(1.03); }
.dialog-btn:active { transform: scale(.97); }
.dialog-btn.save { background: var(--accent); color: #fff; }
.dialog-btn.cancel { background: var(--bg3); color: var(--fg); }
.dialog-btn:hover { opacity: .9; }

/* ---------- Toasts ---------- */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 16px; border-radius: var(--radius); font-size: 13px;
  animation: toastIn .35s var(--spring) both;
  background: var(--bg2); border: 1px solid var(--border); color: var(--fg);
  box-shadow: var(--shadow);
}
.toast-error { border-left: 4px solid var(--red); }
.toast-success { border-left: 4px solid var(--green); }

/* ---------- Export menu ---------- */
.export-wrap { position: relative; display: inline-block; width: 100%; }
.export-menu {
  display: none; position: absolute; bottom: 100%; left: 0;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 4px; z-index: 10; min-width: 100px;
  box-shadow: var(--shadow-lg);
  animation: dialogIn .2s var(--spring) both;
}
.export-menu.open { display: flex; flex-direction: column; }
.export-menu button {
  background: none; border: none; padding: 6px 12px; cursor: pointer;
  color: var(--fg); font-size: 12px; text-align: left; border-radius: 4px;
  transition: background .15s;
}
.export-menu button:hover { background: var(--bg3); }

/* ---------- Plan row ---------- */
#plan-row { max-width: 100% !important; }
#plan-row .msg-bubble { max-width: 100%; }

/* ---------- Scroll to bottom ---------- */
.scroll-bottom {
  position: fixed; bottom: 80px; right: 24px; width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg2); border: 1px solid var(--border); cursor: pointer;
  display: none; align-items: center; justify-content: center; font-size: 18px;
  color: var(--fg2); z-index: 20;
  transition: background .15s, transform .12s var(--spring), box-shadow .15s, opacity .3s;
  opacity: 0;
}
.scroll-bottom:hover { background: var(--bg3); color: var(--fg); transform: scale(1.1); }
.scroll-bottom:active { transform: scale(.95); }
.scroll-bottom.visible { display: flex; opacity: 1; }

/* ---------- Animations ---------- */
@keyframes msgIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes msgSlide { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
@keyframes msgSlideUser { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: translateX(0); } }
@keyframes dialogIn { from { opacity: 0; transform: scale(.92) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }
@keyframes bounce { 0%,80%,100% { transform: scale(0); } 40% { transform: scale(1); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(229,83,75,.25); } }
@keyframes glow { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

/* ---------- Syntax highlighting ---------- */
.hl-kw { color: #ff7b72; }
.hl-str { color: #a5d6ff; }
.hl-cm { color: #8b949e; font-style: italic; }
.hl-fn { color: #d2a8ff; }
.hl-num { color: #79c0ff; }
.hl-tag { color: #7ee787; }
.hl-attr { color: #79c0ff; }
body.light .hl-str { color: #d14; }
body.light .hl-kw { color: #d73a49; }
body.light .hl-fn { color: #6f42c1; }
body.light .hl-tag { color: #22863a; }
body.light .hl-attr { color: #6f42c1; }
body.light .hl-num { color: #005cc5; }
body.cobalt .hl-str { color: #90caf9; }
body.cobalt .hl-kw { color: #ef9a9a; }
body.cobalt .hl-fn { color: #ce93d8; }
body.cobalt .hl-tag { color: #a5d6a7; }
body.cobalt .hl-attr { color: #90caf9; }
body.stone .hl-str { color: #c7b59a; }
body.stone .hl-kw { color: #d4a574; }
body.stone .hl-tag { color: #a88c6a; }
body.stone .hl-attr { color: #c7b59a; }

/* ---------- Skeleton ---------- */
.skeleton { background: linear-gradient(90deg,var(--bg3) 25%,var(--bg2) 37%,var(--bg3) 63%); background-size: 400% 100%; animation: shimmer 1.5s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Quote popup */
.quote-popup {
  position: fixed; background: var(--bg2); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 6px; font-size: 12px; cursor: pointer;
  z-index: 150; box-shadow: var(--shadow-lg); color: var(--fg);
  transition: background .15s, transform .1s var(--spring);
}
.quote-popup:hover { background: var(--bg3); transform: scale(1.04); }

/* Date separators */
.date-separator {
  text-align: center; color: var(--fg3); font-size: 11px;
  margin: 8px 0; letter-spacing: .5px; position: relative;
}
.date-separator::before, .date-separator::after {
  content: ''; position: absolute; top: 50%; width: 25%;
  height: 1px; background: var(--border);
}
.date-separator::before { left: 5%; }
.date-separator::after { right: 5%; }

/* Follow-up buttons */
.followup-row { animation: fadeIn .3s var(--smooth) both; }
.followup-btn {
  padding: 6px 14px; border-radius: 16px; border: 1px solid var(--border);
  background: var(--bg3); color: var(--fg2); cursor: pointer; font-size: 12px;
  transition: background .2s var(--smooth), color .2s var(--smooth), transform .12s var(--spring), box-shadow .2s var(--smooth) !important;
}
.followup-btn:hover {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 2px 12px var(--accent-glow);
}
.followup-btn:active { transform: translateY(0) scale(.97) !important; }

/* ---------- Shortcuts modal ---------- */
.shortcut-key {
  background: var(--bg3); padding: 2px 8px; border-radius: 4px;
  border: 1px solid var(--border); font-family: monospace; font-size: 12px;
}

/* Cookie consent banner */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg2); border-top: 1px solid var(--border);
  padding: 12px 20px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; z-index: 1000;
  box-shadow: var(--shadow-lg); font-size: 14px; color: var(--fg2);
  transition: transform .4s var(--smooth);
}
.cookie-banner.hide { transform: translateY(100%); }
.cookie-text a { color: var(--accent); text-decoration: underline; }
.cookie-btn {
  background: var(--accent); color: #fff; border: none; padding: 8px 18px;
  border-radius: 6px; cursor: pointer; font-size: 14px; white-space: nowrap;
  transition: transform .1s var(--spring), opacity .15s;
}
.cookie-btn:hover { transform: scale(1.04); }
.cookie-btn:active { transform: scale(.97); }

/* Onboarding tour */
.onboarding-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
  animation: fadeIn .2s ease;
}
.onboarding-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 36px 32px 28px;
  max-width: 400px; width: 90%; text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
  animation: dialogIn .35s cubic-bezier(.34,1.56,.64,1) both;
}
.onboarding-icon { font-size: 48px; margin-bottom: 14px; display: block; animation: msgIn .4s cubic-bezier(.34,1.56,.64,1); }
.onboarding-card h3 { margin-bottom: 8px; color: var(--fg); font-size: 20px; }
.onboarding-card p { color: var(--fg2); font-size: 14px; line-height: 1.6; margin-bottom: 0; }
.onboarding-actions { margin-top: 24px; display: flex; gap: 10px; justify-content: center; }
.onboarding-actions button {
  padding: 8px 20px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--fg); cursor: pointer; font-size: 14px;
  transition: background .15s, transform .1s;
}
.onboarding-actions button:hover { background: var(--bg3); }
.onboarding-actions button:active { transform: scale(.97); }
#onboarding-next, #onboarding-finish { background: var(--accent); color: #fff; border-color: var(--accent); }
#onboarding-next:hover, #onboarding-finish:hover { opacity: .9; background: var(--accent); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { animation-duration: .01ms !important; animation-delay: 0 !important; transition-duration: .01ms !important; }
}

/* ---------- Edit / Bookmark buttons ---------- */
.edit-btn, .bookmark-btn {
  background: none; border: none; cursor: pointer; font-size: 13px;
  padding: 2px 4px; vertical-align: middle; line-height: 1;
  transition: transform .1s var(--spring);
}
.edit-btn:hover, .bookmark-btn:hover { transform: scale(1.15); }

/* ---------- Command palette ---------- */
.command-palette {
  position: fixed; z-index: 200; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 220px; max-height: 280px;
  overflow-y: auto; display: none;
  animation: dialogIn .15s var(--spring) both;
}
.cmd-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; cursor: pointer; font-size: 13px; color: var(--fg);
  transition: background .1s;
}
.cmd-item:hover { background: var(--accent-dim); }
.cmd-name { color: var(--accent); font-family: monospace; font-size: 12px; }
.cmd-desc { color: var(--fg2); font-size: 11px; }

/* ---------- Context bar ---------- */
.context-bar { height: 3px; background: var(--bg3); border-radius: 2px; overflow: hidden; margin: 0 16px 4px; }
.context-fill { height: 100%; border-radius: 2px; transition: width .5s var(--smooth), background .4s; }

/* ---------- Auto-scroll toggle ---------- */
.scroll-toggle {
  position: fixed; bottom: 120px; right: 24px; width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg2); border: 1px solid var(--border); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 16px;
  color: var(--fg2); z-index: 20; transition: background .15s, transform .1s var(--spring);
}
.scroll-toggle:hover { background: var(--bg3); color: var(--fg); transform: scale(1.08); }
.scroll-toggle:active { transform: scale(.95); }

/* ---------- Auto-mode step visualization ---------- */
.auto-step {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 16px; margin: 2px 0;
  font-size: 13px; line-height: 1.5;
  border-left: 3px solid var(--border);
  transition: border-color .4s var(--smooth), background .3s;
  max-width: 85%; align-self: flex-start;
  border-radius: 0 8px 8px 0;
}
.auto-step.completed { border-left-color: var(--green); background: linear-gradient(90deg, rgba(35,134,54,.04), transparent); }
.auto-step.working {
  border-left-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-dim), transparent);
  animation: stepPulse 1.4s infinite;
}
@keyframes stepPulse { 0%, 100% { opacity: 1; } 50% { opacity: .6; } }
.step-icon { display: inline-block; width: 24px; flex-shrink: 0; }
.step-desc { display: flex; gap: 6px; align-items: baseline; }
.step-detail { margin-top: 4px; font-size: 12px; color: var(--fg2); padding-left: 28px; }

/* ---------- Bookmarks ---------- */
#bookmarks-section { border-top: 1px solid var(--border); padding: 8px; }
.bookmark-toggle { transition: transform .2s; }
.bookmark-toggle.open { transform: rotate(90deg); }
#bookmark-list { display: flex; flex-direction: column; gap: 2px; max-height: 150px; overflow-y: auto; }
.bookmark-item {
  font-size: 12px; padding: 6px 8px; border-radius: 6px; cursor: pointer;
  color: var(--fg2); transition: background .2s, color .15s, transform .1s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--bg3); border: 1px solid transparent;
  display: flex; flex-direction: column;
}
.bookmark-item:hover { background: var(--accent-dim); color: var(--fg); border-color: var(--border); transform: translateX(2px); }
.bookmark-item:active { transform: scale(.98); }
.bookmark-item small { color: var(--fg3); font-size: 10px; display: block; margin-top: 2px; }

/* ---------- Custom scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; transition: background .2s; }
::-webkit-scrollbar-thumb:hover { background: var(--fg3); }
.chat-list::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--accent), transparent 80%); }

/* ---------- Native tooltip ---------- */
[title] { position: relative; }
[title]:hover::after {
  content: attr(title); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--bg2); color: var(--fg); border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 10px; font-size: 11px; white-space: nowrap; z-index: 999;
  box-shadow: var(--shadow-lg); animation: fadeIn .12s ease;
  pointer-events: none;
}

/* ---------- Dialog backdrop ---------- */
.dialog-overlay { backdrop-filter: blur(6px); }

/* ---------- Auto-mode progress bar ---------- */
.auto-progress { display: flex; align-items: center; gap: 8px; padding: 0 16px 4px; }
.auto-progress-track { flex: 1; height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; max-width: 200px; }
.auto-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-hover)); border-radius: 2px; transition: width .4s var(--smooth); box-shadow: 0 0 8px var(--accent-glow, var(--accent)); animation: progressGlow 2s ease-in-out infinite; }
@keyframes progressGlow { 0%, 100% { box-shadow: 0 0 4px var(--accent); } 50% { box-shadow: 0 0 12px var(--accent); } }

/* ---------- Selection ---------- */
::selection { background: var(--accent); color: #fff; }

/* ---------- Arena grid ---------- */
.arena-wrap { max-width: 100%; margin: 8px 0; }
.arena-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.arena-col {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden;
  animation: msgIn .3s var(--smooth) both;
}
.arena-header {
  padding: 8px 12px; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; background: var(--bg3); border-bottom: 1px solid var(--border);
  color: var(--accent);
}
.arena-body { flex: 1; padding: 8px 12px; min-height: 60px; }
.arena-status { font-size: 12px; color: var(--fg2); }
.arena-content { font-size: 13px; line-height: 1.6; color: var(--fg); word-wrap: break-word; }
.arena-pick {
  margin: 6px 8px 8px; padding: 6px; border: none; border-radius: 6px;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: transform .12s var(--spring), opacity .15s;
}
.arena-pick:hover { transform: scale(1.04); }
.arena-pick:active { transform: scale(.96); }

/* ---------- Swarm panel ---------- */
.swarm-wrap { max-width: 100%; margin: 8px 0; }
.swarm-planning {
  padding: 12px 16px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; color: var(--fg2);
  display: flex; align-items: center; gap: 8px; animation: msgIn .3s var(--smooth) both;
}
.swarm-step {
  margin: 6px 0; animation: msgIn .3s var(--smooth) both;
}
.swarm-step details {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: border-color .2s;
}
.swarm-step details[open] { border-color: var(--accent); }
.swarm-step summary {
  padding: 8px 12px; cursor: pointer; font-size: 13px; color: var(--fg);
  display: flex; align-items: center; gap: 6px; user-select: none;
  transition: background .15s;
}
.swarm-step summary:hover { background: var(--bg3); }
.swarm-step summary::-webkit-details-marker { color: var(--fg2); }
.step-prov { font-size: 11px; color: var(--fg2); font-weight: 400; }
.swarm-step-content {
  padding: 8px 12px 12px; font-size: 13px; line-height: 1.6; color: var(--fg);
  border-top: 1px solid var(--border);
}
.swarm-working { color: var(--fg2); font-style: italic; }
.swarm-merging {
  padding: 10px 16px; margin: 8px 0; background: var(--accent-dim);
  border: 1px solid var(--accent); border-radius: var(--radius);
  animation: msgIn .3s var(--smooth) both;
}
.swarm-merge-label { font-size: 13px; color: var(--fg); display: flex; align-items: center; gap: 6px; }

/* ---------- Arena providers picker ---------- */
.arena-providers {
  padding: 4px 4px 4px 12px; border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 2px; font-size: 12px;
}
.arena-providers .tool-toggle { font-size: 12px; }

/* ---------- Smooth focus ring ---------- */
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Gradient text utility ---------- */
.gradient-text { background: linear-gradient(135deg, var(--accent), #6c63ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* ---------- Welcome cards ---------- */
.welcome-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 500px; margin: 0 auto; }
.welcome-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 10px; cursor: pointer; text-align: center;
  font-family: inherit; color: var(--fg);
  transition: transform .15s var(--spring), border-color .2s var(--smooth), box-shadow .2s var(--smooth), background .2s;
  animation: msgIn .35s var(--smooth) both;
}
.welcome-card:hover { transform: translateY(-2px); border-color: var(--accent-dim); box-shadow: var(--shadow-glow), 0 4px 16px rgba(0,0,0,.12); background: var(--bg3); }
.welcome-card:active { transform: scale(.97); }
.welcome-card:nth-child(2) { animation-delay: .05s; }
.welcome-card:nth-child(3) { animation-delay: .1s; }
.welcome-card:nth-child(4) { animation-delay: .15s; }
.welcome-card:nth-child(5) { animation-delay: .2s; }
.wc-emoji { font-size: 28px; line-height: 1; margin-bottom: 4px; }
.wc-title { font-size: 13px; font-weight: 600; }
.wc-desc { font-size: 11px; color: var(--fg2); line-height: 1.3; }

/* ---------- Basic/Advanced toggle ---------- */
.sidebar-btn-accent {
  background: var(--accent-dim); color: var(--accent); font-weight: 600; border-color: var(--accent-dim) !important;
  transition: background .3s var(--smooth), color .3s var(--smooth), transform .15s var(--spring);
}
.sidebar-btn-accent:hover { background: var(--accent) !important; color: #fff !important; transform: translateX(3px); }
.sidebar-btn-accent.open { background: var(--accent); color: #fff; }
#advanced-controls {
  overflow: hidden; transition: max-height .35s var(--smooth), opacity .3s var(--smooth);
  max-height: 0; opacity: 0;
}
#advanced-controls.open { max-height: 600px; opacity: 1; }

/* ---------- Arena enhancements ---------- */
.arena-stats { display: flex; gap: 10px; font-size: 11px; color: var(--fg2); padding: 4px 12px; background: var(--bg3); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.arena-speed { color: var(--green); }
.arena-ttfb { color: var(--accent); }
.arena-chars { color: var(--fg2); }
.arena-vote { padding: 6px 12px; border-top: 1px solid var(--border); font-size: 11px; }
.vote-row { display: flex; align-items: center; gap: 4px; margin: 2px 0; }
.vote-label { color: var(--fg2); min-width: 60px; font-size: 10px; text-transform: uppercase; letter-spacing: .3px; }
.star { cursor: pointer; color: #ffc107; font-size: 14px; transition: transform .1s; display: inline-block; }
.star:hover { transform: scale(1.3); }
.star:active { transform: scale(.9); }
#leaderboard-container { padding: 4px 8px; border-top: 1px solid var(--border); animation: fadeIn .3s ease; }
.lb-row { display: flex; align-items: center; gap: 4px; padding: 2px 0; font-size: 11px; }
.lb-rank { color: var(--fg3); min-width: 14px; }
.lb-score { color: var(--accent); margin-left: auto; font-weight: 600; }
.action-btn { display: block; margin: 8px auto; padding: 8px 20px; border: none; border-radius: 8px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; transition: transform .15s var(--spring), opacity .15s; }
.action-btn:hover { transform: scale(1.04); opacity: .9; }
.action-btn:active { transform: scale(.97); }

/* ---------- Consensus modal ---------- */
.consensus-modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999;
  background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); animation: fadeIn .2s ease;
}
.consensus-modal-inner {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; max-width: 560px; width: 90%; max-height: 80vh; overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,.5); animation: dialogIn .3s cubic-bezier(.34,1.56,.64,1) both;
}
.consensus-modal-inner h3 { font-size: 18px; font-weight: 700; }
.consensus-modal-inner h4 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.consensus-panel { margin-bottom: 14px; padding: 12px; border-radius: 8px; border: 1px solid var(--border); }
.consensus-panel.agreement { border-left: 3px solid var(--green); background: linear-gradient(90deg, rgba(35,134,54,.04), transparent); }
.consensus-panel.conflict { border-left: 3px solid #f0c040; background: linear-gradient(90deg, rgba(240,192,64,.04), transparent); }
.consensus-panel.verdict { border-left: 3px solid var(--accent); background: linear-gradient(90deg, var(--accent-dim), transparent); }
.cp-body { font-size: 13px; line-height: 1.6; color: var(--fg); }
.close-modal { padding: 6px 16px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg2); color: var(--fg); cursor: pointer; font-size: 12px; transition: background .15s; }
.close-modal:hover { background: var(--bg3); }

/* ---------- tooltip system ---------- */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%); background: var(--bg2); color: var(--fg);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px;
  font-size: 11px; white-space: nowrap; z-index: 999;
  box-shadow: var(--shadow-lg); animation: fadeIn .12s ease; pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- More actions popover ---------- */
.more-btn {
  background: var(--bg3); border: 1px solid var(--border); color: var(--fg2);
  font-size: 14px; padding: 8px 10px; cursor: pointer; border-radius: 8px; flex-shrink: 0;
  transition: color .15s, background .15s, transform .12s var(--spring), border-color .15s;
  line-height: 1;
}
.more-btn:hover { color: var(--fg); background: var(--border); border-color: var(--fg3); transform: scale(1.05); }
.more-btn:active { transform: scale(.92); }
.more-btn.open { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-dim); }
.more-popover {
  position: absolute; bottom: calc(100% + 6px); left: 0;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 4px; z-index: 50; min-width: 150px;
  box-shadow: var(--shadow-lg); animation: dialogIn .15s var(--spring) both;
  display: flex; flex-direction: column; gap: 2px;
}
.more-popover .icon-btn {
  background: none; border: none; padding: 8px 12px; border-radius: 6px;
  cursor: pointer; color: var(--fg); font-size: 13px; text-align: left;
  transition: background .1s; display: flex; align-items: center; gap: 8px;
  font-family: inherit;
}
.more-popover .icon-btn:hover { background: var(--bg3); }
.more-popover .icon-btn:active { transform: scale(.98); }

/* ---------- Suggestions button ---------- */
.suggest-btn {
  background: none; border: none; color: var(--fg2); font-size: 18px; padding: 8px 6px;
  cursor: pointer; border-radius: 8px; flex-shrink: 0;
  transition: color .15s, transform .12s var(--spring), background .15s;
  line-height: 1;
}
.suggest-btn:hover { color: var(--accent); background: var(--accent-dim); transform: scale(1.1); }
.suggest-btn:active { transform: scale(.92); }

/* Focused hint animation */
.input-wrap textarea.focused-hint::placeholder { color: var(--accent); transition: color .5s var(--smooth); }

/* ---------- Enhanced step messages ---------- */
.auto-step.working {
  border-left-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-dim), transparent);
  animation: stepPulse 1.4s infinite;
  font-size: 14px;
  padding: 12px 18px;
}
.auto-step.working .step-icon { font-size: 18px; }
.auto-step.working .step-desc { font-size: 14px; color: var(--fg); font-weight: 500; }
.auto-step.completed { border-left-width: 3px; padding: 10px 16px; }
.auto-step.completed .step-icon { font-size: 16px; }
.auto-step.completed .step-desc { font-size: 13px; }
.auto-step.completed .step-desc strong { font-size: 12px; }


