/* ===== Midnight AI - CSS Part 3: Messages, input, modals, multi-chat, multimind, call UI ===== */

/* ---------- MESSAGES ---------- */
#chat-scroll { flex: 1; overflow-y: auto; }
#chat-scroll::-webkit-scrollbar { width: 8px; }
#chat-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
#messages { max-width: var(--content-max-w, 720px); margin: 0 auto; padding: 24px 18px 12px; display: flex; flex-direction: column; gap: 22px; min-height: 100%; }

.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 20px; }
.empty-mark { width: 56px; height: 56px; border-radius: 16px; background: var(--accent) url('https://hostgambar.vercel.app/image/AgACAgUAAyEGAATk_963AAICHGqIbusgQc2prKeZaCX5MTq33FoSAAL7FGsb-5lIVM7d8EEPsfd3AQADAgADeQADPQQ') center/cover; }
.empty-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.empty-sub { font-size: 13.5px; color: var(--text-muted); max-width: 320px; }
.suggest-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; max-width: 460px; }
.suggest-chip { border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); font-size: 12.5px; padding: 8px 14px; border-radius: 20px; cursor: pointer; transition: background .12s, color .12s; }
.suggest-chip:hover { background: var(--surface2); color: var(--text); }

.msg-row { display: flex; gap: 12px; }
.msg-row.user { flex-direction: row-reverse; }
.msg-avatar { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; overflow: hidden; }
.msg-avatar img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.msg-row.ai .msg-avatar { background: var(--surface2) url('https://hostgambar.vercel.app/image/AgACAgUAAyEGAATk_963AAICHGqIbusgQc2prKeZaCX5MTq33FoSAAL7FGsb-5lIVM7d8EEPsfd3AQADAgADeQADPQQ') center/cover; color: transparent; }
.msg-row.user .msg-avatar { background: var(--accent); color: var(--accent-fg); }
.msg-bubble { max-width: 82%; font-size: 14.5px; line-height: 1.65; word-wrap: break-word; }
.msg-row.user .msg-bubble { background: var(--surface); border: 1px solid var(--border); padding: 10px 14px; border-radius: 16px 4px 16px 16px; }
.msg-row.ai .msg-bubble { padding-top: 4px; }
.msg-bubble p { margin-bottom: 10px; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-bubble ul, .msg-bubble ol { margin: 6px 0 10px 20px; }
.msg-bubble li { margin-bottom: 4px; }
.msg-bubble code { font-family: 'JetBrains Mono', monospace; background: var(--surface2); padding: 2px 5px; border-radius: 5px; font-size: 12.5px; }
.msg-bubble pre { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; overflow-x: auto; margin: 8px 0; }
.msg-bubble pre code { background: none; padding: 0; font-size: 12.5px; }
.msg-bubble strong { font-weight: 700; }
.msg-bubble a { color: var(--accent); text-decoration: underline; }
.msg-bubble.msg-error { color: var(--danger); }
.msg-bubble.msg-error p { color: var(--danger); }

.typing-dots { display: flex; align-items: center; gap: 4px; padding: 8px 0; }
.typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: dot 1.4s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%,60%,100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
.typing-label { font-size: 12px; color: var(--text-muted); margin-left: 4px; }

/* ---------- ATTACHMENTS IN BUBBLE ---------- */
.msg-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.msg-attach-thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; border: 1px solid var(--border2); }
.msg-attach-file { display: flex; align-items: center; gap: 6px; background: var(--surface2); border: 1px solid var(--border2); border-radius: 10px; padding: 6px 10px; font-size: 11.5px; max-width: 150px; }
.msg-attach-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- ACTIONS / SOURCES / CARDS ---------- */
.msg-actions { display: flex; gap: 2px; margin-top: 6px; }
.msg-actions button { width: 27px; height: 27px; border: none; background: transparent; color: var(--text-muted); border-radius: 7px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .12s, color .12s; }
.msg-actions button:hover { background: var(--surface); color: var(--text); }
.msg-actions button.copied { color: #22c55e; }
.icon-btn.copied { color: #22c55e; }
.share-wrap { position: relative; }
.share-menu { display: none; position: absolute; top: 42px; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px; min-width: 168px; box-shadow: 0 8px 24px rgba(0,0,0,.35); z-index: 40; flex-direction: column; gap: 2px; }
.share-menu.open { display: flex; }
.share-menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: none; background: transparent; color: var(--text); font-size: 13px; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-family: inherit; }
.share-menu button:hover { background: var(--bg); }
.share-ic { flex-shrink: 0; }

.sources-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.source-chip { font-size: 11px; padding: 5px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text-dim); text-decoration: none !important; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-chip:hover { background: var(--surface2); color: var(--text); }

.code-card, .image-card { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin-top: 8px; background: var(--surface); width: 280px; max-width: 100%; animation: csFadeIn .18s ease; }
.code-card .cc-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 12.5px; font-weight: 600; border-bottom: 1px solid var(--border); cursor: pointer; }
.code-card .cc-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-card .cc-actions { display: flex; gap: 6px; padding: 10px 12px; }
.code-card .cc-footer { padding: 7px 12px; font-size: 10.5px; color: var(--text-dim); border-top: 1px solid var(--border); opacity: .75; }
.cc-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 0; border-radius: 9px; border: 1px solid var(--border2); background: var(--bg); color: var(--text); font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.cc-btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.cc-btn:hover { opacity: .85; }

/* Baris kedua khusus HTML: tombol "Salin HTML", ditaruh di tengah di bawah baris Preview/Unduh */
.code-card .cc-actions-secondary { padding-top: 0; justify-content: center; }
.cc-btn.cc-copy-html { flex: none; padding: 7px 18px; border-style: dashed; color: var(--text-dim); transition: background .15s, color .15s, border-color .15s, transform .1s; }
.cc-btn.cc-copy-html svg { flex-shrink: 0; }
.cc-btn.cc-copy-html:active { transform: scale(.96); }
.cc-btn.cc-copy-html.copied { border-style: solid; border-color: #22c55e; color: #16a34a; background: rgba(34,197,94,.08); }

/* ---------- KODE STREAMING LIVE (huruf demi huruf, syntax highlight) di chat utama —
   tampil dulu selagi kode "diketik", lalu diganti kartu label final (Preview/Unduh/Salin). ---------- */
.code-stream-wrap { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin-top: 8px; animation: csFadeIn .18s ease; }
@keyframes csFadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.code-stream-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; background: var(--surface2); border-bottom: 1px solid var(--border); }
.code-stream-lang { display: flex; align-items: center; gap: 7px; font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 500; color: var(--text-dim); letter-spacing: .02em; }
.code-stream-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; animation: csDotPulse 1s ease-in-out infinite; }
@keyframes csDotPulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
.code-stream-status { font-size: 10.5px; color: var(--text-muted); }
.code-stream-body { max-height: 260px; overflow: auto; padding: 10px 12px; }
.code-stream-body::-webkit-scrollbar { width: 4px; height: 4px; }
.code-stream-body::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
.code-stream-body pre { font-family: 'JetBrains Mono', monospace; font-size: 12px; line-height: 1.65; color: var(--text); white-space: pre-wrap; word-break: break-word; margin: 0; }
.code-stream-cursor { display: inline-block; width: 6px; height: 13px; background: var(--accent); vertical-align: text-bottom; margin-left: 1px; animation: csCursorBlink .85s step-end infinite; }
@keyframes csCursorBlink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
.cs-token-keyword { color: #ff7b72; }
:root:not([data-theme]) .cs-token-keyword, :root[data-theme="light"] .cs-token-keyword { color: #d73a49; }
.cs-token-string { color: #a5d6ff; }
:root:not([data-theme]) .cs-token-string, :root[data-theme="light"] .cs-token-string { color: #032f62; }
.cs-token-comment { color: #8b949e; font-style: italic; }
.cs-token-tag { color: #7ee787; }
:root:not([data-theme]) .cs-token-tag, :root[data-theme="light"] .cs-token-tag { color: #22863a; }
.cs-token-attr { color: #d2a8ff; }
:root:not([data-theme]) .cs-token-attr, :root[data-theme="light"] .cs-token-attr { color: #6f42c1; }
.cs-token-number { color: #79c0ff; }
:root:not([data-theme]) .cs-token-number, :root[data-theme="light"] .cs-token-number { color: #005cc5; }
.cs-token-function { color: #d2a8ff; }
:root:not([data-theme]) .cs-token-function, :root[data-theme="light"] .cs-token-function { color: #6f42c1; }

/* ---------- KARTU LOADING GAMBAR/VIDEO — versi elegan: shimmer + orb berputar + progres bertahap ---------- */
.loading-card.gen-card {
  display: flex; flex-direction: column; gap: 0; border: 1px solid rgba(124,92,247,.22); border-radius: 16px;
  padding: 0; background: var(--surface); width: 280px; max-width: 100%; font-size: 12.5px; color: var(--text-dim);
  overflow: hidden; box-shadow: 0 6px 20px -8px rgba(124,92,247,.25);
  animation: genCardIn .35s cubic-bezier(.34,1.2,.4,1) both;
}
@keyframes genCardIn { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.gen-card .gen-canvas {
  position: relative; width: 100%; aspect-ratio: 1 / 1; overflow: hidden;
  background: linear-gradient(135deg, var(--surface2), var(--surface));
}
.gen-card .gen-shimmer {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(124,92,247,.16) 45%, rgba(245,120,154,.18) 50%, rgba(124,92,247,.16) 55%, transparent 70%);
  background-size: 220% 100%; animation: genShimmer 2.1s ease-in-out infinite;
}
@keyframes genShimmer { 0% { background-position: 200% 0; } 100% { background-position: -60% 0; } }
.gen-card .gen-orb-wrap { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.gen-card .gen-orb { position: relative; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
.gen-card .gen-orb svg { width: 20px; height: 20px; color: #7c5cf7; position: relative; z-index: 2; animation: genOrbPulse 1.6s ease-in-out infinite; }
.gen-card .gen-orb::before, .gen-card .gen-orb::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid transparent; border-top-color: #7c5cf7; border-right-color: rgba(245,120,154,.6);
}
.gen-card .gen-orb::before { animation: genOrbSpin 1.1s linear infinite; }
.gen-card .gen-orb::after { inset: -7px; border-top-color: rgba(124,92,247,.35); border-right-color: transparent; animation: genOrbSpin 1.9s linear infinite reverse; }
@keyframes genOrbSpin { to { transform: rotate(360deg); } }
@keyframes genOrbPulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .6; transform: scale(.88); } }
.gen-card .gen-info { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 14px; }
.gen-card .gen-label-row { display: flex; align-items: center; gap: 8px; }
.gen-card .gen-label-row span.gen-txt { font-weight: 600; color: var(--text); }
.gen-card .gen-bar-track { height: 4px; border-radius: 3px; background: var(--surface2); overflow: hidden; }
.gen-card .gen-bar-fill {
  height: 100%; border-radius: 3px; width: 8%;
  background: linear-gradient(90deg, #7c5cf7, #f5789a); transition: width 1.1s cubic-bezier(.4,0,.2,1);
}
.gen-card .gen-hint { font-size: 10.5px; color: var(--text-muted); }

/* ---------- REVEAL GAMBAR JADI — fade + scale + sedikit blur-clear, ada sorotan (sheen) sekali lewat ---------- */
.image-card { position: relative; }
/* FIX ukuran gambar tidak konsisten (kadang besar/kecil/sedang): wrapper dikunci rasio 1:1 SELALU,
   sama seperti kartu loading (.gen-canvas), lepas dari rasio asli gambar yang dikembalikan Pollinations.
   Gambar di dalamnya di-cover supaya tetap penuh & rapi tanpa distorsi. */
.image-card .ic-imgwrap { position: relative; overflow: hidden; background: var(--surface2); width: 100%; aspect-ratio: 1 / 1; }
.image-card img {
  width: 100%; height: 100%; display: block; background: var(--surface2);
  object-fit: cover; object-position: center;
  opacity: 0; transform: scale(1.04); filter: blur(10px);
  transition: opacity .55s ease, transform .6s cubic-bezier(.2,.8,.2,1), filter .6s ease;
}
.image-card img.revealed { opacity: 1; transform: scale(1); filter: blur(0); }
.image-card .ic-sheen {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.55) 48%, transparent 62%);
  background-size: 250% 100%; background-position: 150% 0; opacity: 0;
}
.image-card .ic-sheen.play { animation: icSheenPlay 1s ease-out; }
@keyframes icSheenPlay { 0% { opacity: 1; background-position: 150% 0; } 100% { opacity: 0; background-position: -60% 0; } }
.image-card .ic-actions { padding: 8px; }
:root[data-theme="neutral-dark"] .image-card .ic-sheen, :root[data-theme="blue-dark"] .image-card .ic-sheen, :root[data-theme="purple-dark"] .image-card .ic-sheen {
  background: linear-gradient(115deg, transparent 35%, rgba(255,255,255,.22) 48%, transparent 62%);
}

.loading-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--surface); max-width: 260px; font-size: 12.5px; color: var(--text-dim); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--border2); border-top-color: var(--accent); animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- INPUT ---------- */
#input-wrap { padding: 12px 16px max(14px, env(safe-area-inset-bottom, 14px)); flex-shrink: 0; }
#attach-row { max-width: var(--content-max-w, 720px); margin: 0 auto 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.attach-chip { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 5px 6px; font-size: 11.5px; color: var(--text-dim); max-width: 170px; }
.attach-chip img, .attach-chip video { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.attach-chip .ac-file-icon { width: 26px; height: 26px; border-radius: 6px; background: var(--surface2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-muted); }
.attach-chip .ac-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip .ac-remove { cursor: pointer; color: var(--text-muted); flex-shrink: 0; display: flex; }
.attach-chip .ac-remove:hover { color: var(--danger); }

#input-box { max-width: var(--content-max-w, 720px); margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px 8px 8px; transition: border-color .15s; }
#input-box:focus-within { border-color: var(--border2); }
.plus-btn-wrap { position: relative; flex-shrink: 0; }
.plus-menu { position: absolute; bottom: 44px; left: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 6px; display: none; flex-direction: column; min-width: 175px; z-index: 60; }
.plus-menu.show { display: flex; }
.plus-menu button { display: flex; align-items: center; gap: 10px; background: none; border: none; padding: 9px 10px; border-radius: 9px; font-family: inherit; font-size: 13px; color: var(--text); cursor: pointer; text-align: left; }
.plus-menu button:hover { background: var(--surface); }

.model-picker-wrap { position: relative; }
.model-menu { display: none; position: absolute; bottom: 40px; left: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px; min-width: 175px; box-shadow: 0 8px 24px rgba(0,0,0,.28); z-index: 60; flex-direction: column; gap: 2px; }
.model-menu.open { display: flex; }
.model-menu button { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; border: none; background: transparent; color: var(--text); font-size: 13px; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-family: inherit; }
.model-menu button:hover { background: var(--bg); }
.model-menu button.active { background: var(--surface2); font-weight: 600; }
.beta-badge { font-size: 9.5px; font-weight: 700; letter-spacing: .02em; background: var(--accent); color: var(--accent-fg); padding: 1px 6px; border-radius: 20px; margin-left: auto; }
.think-mini-tag { margin-left: auto; font-size: 9.5px; font-weight: 700; letter-spacing: .01em; padding: 1px 7px; border-radius: 20px; flex-shrink: 0; }
.think-mini-tag.on { background: rgba(124,92,247,.16); border: 1px solid rgba(124,92,247,.4); color: #7c5cf7; }
.think-mini-tag.off { background: var(--surface2); border: 1px solid var(--border); color: var(--text-muted); }
#msg-input { flex: 1; border: none; background: transparent; resize: none; font-family: inherit; font-size: 14.5px; color: var(--text); max-height: 160px; line-height: 1.5; padding: 8px 4px; }
#msg-input::placeholder { color: var(--text-muted); }
#send-btn { width: 38px; height: 38px; border-radius: 50%; border: none; background: var(--accent); color: var(--accent-fg); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: opacity .15s, transform .1s; }
#send-btn:disabled { opacity: .35; cursor: default; }
#send-btn:active:not(:disabled) { transform: scale(.92); }

#input-toolbar { max-width: var(--content-max-w, 720px); margin: 8px auto 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tool-toggle { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text-dim); border-radius: 16px; padding: 6px 12px; font-size: 12px; cursor: pointer; transition: all .15s; font-family: inherit; }
.tool-toggle svg { flex-shrink: 0; }
.tool-toggle.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* ---------- Toggle "Perjelas Prompt" — gaya elegan (emas lembut), kecil dan tidak mencolok ---------- */
.prompt-enhance-toggle.active {
  background: linear-gradient(100deg, rgba(184,134,11,.14), rgba(230,199,102,.22));
  color: #a6790a; border-color: rgba(184,134,11,.45);
}
.prompt-enhance-toggle.active svg { color: #b8860b; filter: drop-shadow(0 0 3px rgba(184,134,11,.35)); }
/* Efek kecil "mendetailkan" di bubble prompt sesaat setelah dikirim, saat Perjelas Prompt aktif */
.prompt-detail-shimmer {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  color: #a6790a; margin-top: 5px; opacity: 0; animation: peFadeIn .35s ease forwards;
}
.prompt-detail-shimmer svg { width: 11px; height: 11px; animation: peSpin 1.1s linear infinite; }
@keyframes peFadeIn { to { opacity: 1; } }
@keyframes peSpin { to { transform: rotate(360deg); } }
.prompt-detail-final {
  font-size: 11px; color: var(--text-muted); margin-top: 6px; font-style: italic; line-height: 1.4;
  border-left: 2px solid rgba(184,134,11,.4); padding-left: 8px;
}

/* ---------- CARI WEB: tombol khusus dengan efek hidup (biru, beda dari toggle lain) ---------- */
#webSearchToggle { position: relative; overflow: visible; }
#webSearchToggle svg circle, #webSearchToggle svg path { transition: stroke .2s; }
#webSearchToggle.active {
  background: linear-gradient(120deg, #1d6fe0, #2563eb 55%, #3b82f6);
  color: #fff; border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37,99,235,.35), 0 2px 12px -2px rgba(37,99,235,.55);
  animation: webSearchPulseBtn 2.2s ease-in-out infinite;
}
#webSearchToggle.active svg { animation: webSearchSpin 5s linear infinite; }
@keyframes webSearchSpin { to { transform: rotate(360deg); } }
@keyframes webSearchPulseBtn {
  0%, 100% { box-shadow: 0 0 0 1px rgba(37,99,235,.35), 0 2px 12px -2px rgba(37,99,235,.55); }
  50% { box-shadow: 0 0 0 3px rgba(37,99,235,.18), 0 2px 18px 0 rgba(37,99,235,.7); }
}

/* ---------- INDIKATOR "MENELUSURI WEB" — kartu status bertahap, gantikan dot polos ---------- */
.web-search-card {
  display: flex; flex-direction: column; gap: 10px;
  border: 1px solid rgba(37,99,235,.28); border-radius: 14px;
  background: linear-gradient(160deg, rgba(37,99,235,.08), rgba(37,99,235,.02));
  padding: 12px 14px; max-width: 340px; margin-bottom: 4px;
  animation: wscIn .3s ease both;
}
@keyframes wscIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.web-search-card .wsc-head { display: flex; align-items: center; gap: 9px; }
.wsc-orb { position: relative; width: 22px; height: 22px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.wsc-orb svg { width: 15px; height: 15px; color: #2563eb; position: relative; z-index: 2; animation: webSearchSpin 4s linear infinite; }
.wsc-orb::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(37,99,235,.18); border-top-color: #2563eb;
  animation: wscSpin .9s linear infinite;
}
@keyframes wscSpin { to { transform: rotate(360deg); } }
.wsc-title { font-size: 12.5px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.wsc-title .wsc-dyn { display: inline-block; min-width: 1px; }
.wsc-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.wsc-steps { display: flex; flex-direction: column; gap: 5px; padding-left: 31px; }
.wsc-step { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-muted); opacity: .45; transition: opacity .25s, color .25s; }
.wsc-step .wsc-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; transition: background .25s, box-shadow .25s; }
.wsc-step.done { opacity: 1; color: var(--text-dim); }
.wsc-step.done .wsc-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.wsc-step.current { opacity: 1; color: #2563eb; font-weight: 600; }
.wsc-step.current .wsc-dot { background: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.18); animation: wscDotPulse 1s ease-in-out infinite; }
@keyframes wscDotPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.5); } }
.wsc-chiprow { display: flex; flex-wrap: wrap; gap: 5px; padding-left: 31px; }
.wsc-chip-skel { height: 20px; width: 74px; border-radius: 10px; background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%); background-size: 200% 100%; animation: wscShimmer 1.4s ease-in-out infinite; }
@keyframes wscShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- SUMBER HASIL PENCARIAN — chip lebih hidup dengan favicon & hover ---------- */
.sources-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.sources-row .sources-label { width: 100%; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; display: flex; align-items: center; gap: 5px; }
.sources-row .sources-label svg { width: 11px; height: 11px; color: #2563eb; }
.source-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 500; padding: 6px 12px 6px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
  text-decoration: none !important; max-width: 190px; overflow: hidden;
  transition: background .15s, border-color .15s, transform .12s, box-shadow .15s;
}
.source-chip .src-favicon { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; background: var(--surface2) center/cover; }
.source-chip .src-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-chip:hover { background: rgba(37,99,235,.08); border-color: rgba(37,99,235,.4); color: var(--text); transform: translateY(-1px); box-shadow: 0 3px 10px -2px rgba(37,99,235,.25); }
.mode-toggle-group { display: flex; gap: 4px; border: 1px solid var(--border); border-radius: 16px; padding: 3px; margin-right: 2px; }
.mode-toggle { display: flex; align-items: center; gap: 6px; border: none; background: transparent; color: var(--text-dim); border-radius: 13px; padding: 5px 11px; font-size: 12px; cursor: pointer; transition: all .15s; font-family: inherit; }
.mode-toggle svg { flex-shrink: 0; }
.mode-toggle.active { background: var(--accent); color: var(--accent-fg); }
.thinking-status { font-size: 12.5px; color: var(--text-dim); }
.input-hint { text-align: center; font-size: 10.5px; color: var(--text-muted); margin-top: 8px; }

/* ---------- MODAL ---------- */
.modal-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity .2s; }

/* ---------- APP DRAWER (bukan popup - panel yang muncul dari bawah, tidak mengunci layar) ---------- */
#appListModal.app-drawer {
  position: fixed; left: 50%; bottom: 12px; z-index: 90;
  width: calc(100% - 24px); max-width: 440px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: 0 12px 34px rgba(0,0,0,.22);
  padding: 16px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; max-height: 72vh;
  transform: translate(-50%, calc(100% + 20px)); opacity: 0;
  transition: transform .26s cubic-bezier(.4,0,.2,1), opacity .2s;
  pointer-events: none;
}
#appListModal.app-drawer.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.app-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-shrink: 0; }
.app-drawer-head .modal-title { margin-bottom: 0; }
.app-drawer .info-modal-body { margin-bottom: 12px; flex-shrink: 0; }

/* ---------- TOAST (notifikasi ringan non-popup, pengganti alert()) ---------- */
.app-toast {
  position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 16px);
  max-width: min(88vw, 380px); background: var(--accent); color: var(--accent-fg);
  font-size: 13px; font-weight: 500; line-height: 1.4; padding: 12px 16px; border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.22); z-index: 300; opacity: 0; pointer-events: none;
  transition: transform .22s cubic-bezier(.4,0,.2,1), opacity .22s;
}
.app-toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal-scrim.show { opacity: 1; pointer-events: auto; }
.modal-card { background: var(--bg); border: 1px solid var(--border); border-radius: 20px; padding: 28px 24px; width: 100%; max-width: 340px; text-align: center; transform: translateY(8px) scale(.98); transition: transform .2s; }
.modal-scrim.show .modal-card { transform: translateY(0) scale(1); }
.modal-mark { width: 48px; height: 48px; border-radius: 14px; background: var(--accent) url('https://hostgambar.vercel.app/image/AgACAgUAAyEGAATk_963AAICHGqIbusgQc2prKeZaCX5MTq33FoSAAL7FGsb-5lIVM7d8EEPsfd3AQADAgADeQADPQQ') center/cover; margin: 0 auto 14px; }
.modal-title { font-size: 18px; font-weight: 800; margin-bottom: 6px; letter-spacing: -0.01em; }
.modal-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.5; }
.modal-input { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--border2); background: var(--surface); color: var(--text); font-family: inherit; font-size: 14px; text-align: center; margin-bottom: 14px; }
.modal-btn { width: 100%; padding: 11px 0; border-radius: 12px; border: none; background: var(--accent); color: var(--accent-fg); font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; }
.modal-btn:hover { background: var(--accent-hover); }

.settings-card { max-width: 380px; text-align: left; }
.settings-card .modal-title, .settings-card .modal-sub { text-align: center; }
.field-label { font-size: 12px; font-weight: 700; color: var(--text-dim); margin: 12px 0 6px; }
.settings-card .modal-input { text-align: left; margin-bottom: 0; font-family: 'JetBrains Mono', monospace; font-size: 12.5px; }
.settings-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 16px; line-height: 1.55; text-align: left; }
.settings-hint a { color: var(--text); }

.settings-block { margin-bottom: 16px; }
.settings-block-label { font-size: 11.5px; font-weight: 700; color: var(--text-muted); letter-spacing: .04em; text-transform: uppercase; margin-bottom: 8px; }
.fontsize-row { display: flex; gap: 6px; flex-wrap: wrap; }
.fontsize-btn { flex: 1; min-width: 40px; padding: 9px 0; border-radius: 10px; border: 1px solid var(--border2); background: var(--surface); color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background .12s, color .12s, border-color .12s; display: flex; align-items: center; justify-content: center; }
.fontsize-btn:hover { background: var(--surface2); }
.fontsize-btn.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.settings-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: none; background: var(--surface); color: var(--text); font-family: inherit; font-size: 13.5px; font-weight: 600; padding: 12px 12px; border-radius: 12px; cursor: pointer; margin-bottom: 8px; transition: background .12s; }
.settings-item:hover { background: var(--surface2); }
.settings-item svg { flex-shrink: 0; color: var(--text-dim); }
.settings-item.danger { color: var(--danger); }
.settings-item.danger svg { color: var(--danger); }
.settings-item .si-chevron { margin-left: auto; color: var(--text-muted); }
.info-modal-body { font-size: 13px; color: var(--text-dim); line-height: 1.6; text-align: left; margin-bottom: 16px; }
.info-modal-body b { color: var(--text); }
.memory-stats { display: flex; gap: 8px; margin-bottom: 16px; }
.memory-stat { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; text-align: center; }
.memory-stat-num { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.memory-stat-label { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }

.limit-block { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.limit-block-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.limit-block-title { font-size: 13px; font-weight: 700; }
.limit-block-pct { font-size: 12.5px; font-weight: 700; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }
.limit-bar-wrap { width: 100%; height: 8px; border-radius: 20px; background: var(--surface2); overflow: hidden; }
.limit-bar-fill { height: 100%; border-radius: 20px; background: var(--accent); transition: width .25s ease, background .25s ease; }
.limit-block-sub { font-size: 11px; color: var(--text-muted); margin-top: 7px; }
.limit-block.unlimited .limit-block-pct { color: var(--accent); }
.limit-group-label { font-size: 11.5px; font-weight: 700; color: var(--text-muted); letter-spacing: .04em; text-transform: uppercase; margin: 14px 0 8px; }
.limit-group-label:first-child { margin-top: 0; }
.limit-block.trial .limit-block-pct { color: var(--accent); }
.limit-block.inactive { opacity: .6; }
.limit-block.inactive .limit-block-pct { color: var(--text-muted); }

.app-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 0; flex: 1; overflow-y: auto; padding-bottom: 4px; }
.app-grid::-webkit-scrollbar { width: 6px; }
.app-grid::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
.app-chip { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: background .12s, transform .1s; }
.app-chip:hover { background: var(--surface2); }
.app-chip:active { transform: scale(.96); }
.app-chip-icon { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), var(--accent-hover)); color: var(--accent-fg); display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 800; font-family: 'JetBrains Mono', monospace; letter-spacing: -0.02em; }
.app-chip-label { font-size: 10.5px; font-weight: 600; text-align: center; line-height: 1.25; }

.google-btn-container { display: flex; justify-content: center; min-height: 40px; margin-bottom: 4px; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 16px 0 14px; color: var(--text-muted); font-size: 11.5px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.settings-item .si-sub { margin-left: auto; margin-right: 4px; font-size: 11.5px; font-weight: 500; color: var(--text-muted); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px 18px; }
.account-row-avatar { width: 48px; height: 48px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-hover)); display: flex; align-items: center; justify-content: center; color: var(--accent-fg); font-family: 'JetBrains Mono', monospace; font-size: 16px; font-weight: 700; flex-shrink: 0; overflow: hidden; }
.account-row-avatar.avatar-owner-frame {
  border: 2px solid #d4af37;
  box-shadow: 0 0 0 3px rgba(212,175,55,.22), 0 0 16px rgba(212,175,55,.4);
}
.account-row-avatar.avatar-admin-frame {
  border: 2px solid #a9b4c0;
  box-shadow: 0 0 0 3px rgba(148,163,184,.2), 0 0 16px rgba(148,163,184,.35);
}
.account-row-avatar img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
.account-avatar-cam {
  position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg); display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--white); pointer-events: none;
}
.user-avatar { position: relative; overflow: hidden; }
.user-avatar img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
.account-row-meta { min-width: 0; }
.account-row-name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-row-email { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-not-connected { font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }

/* ---------- PREVIEW MODAL ---------- */
#previewModal { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 220; display: none; flex-direction: column; }
#previewModal.show { display: flex; }
.preview-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--bg); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.preview-top .pv-title { font-weight: 700; font-size: 14px; }
.preview-top .pv-actions { display: flex; gap: 6px; }
#previewFrame { flex: 1; border: none; background: #fff; width: 100%; }

/* ---------- ARTIFACT GALLERY MODAL ---------- */
#artifactModal { position: fixed; inset: 0; background: var(--bg); z-index: 220; display: none; flex-direction: column; }
#artifactModal.show { display: flex; }
#artifactGrid { flex: 1; overflow-y: auto; padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; align-content: start; }
.artifact-card { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); aspect-ratio: 1; }
.artifact-card img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; display: block; }
.artifact-dl { position: absolute; bottom: 6px; right: 6px; width: 30px; height: 30px; border-radius: 8px; background: rgba(0,0,0,.55); color: #fff; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.artifact-empty { grid-column: 1/-1; text-align: center; color: var(--text-muted); padding: 60px 20px; font-size: 13.5px; }

/* ---------- MEDIA VIEWER MODAL ---------- */
#mediaModal { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 210; display: none; align-items: center; justify-content: center; }
#mediaModal.show { display: flex; }
#mediaModal img, #mediaModal video { max-width: 94vw; max-height: 90vh; object-fit: contain; border-radius: 6px; }
#mediaModalCloseBtn { position: absolute; top: 14px; right: 14px; background: rgba(255,255,255,.12); color: #fff; z-index: 211; }
#mediaModalCloseBtn:hover { background: rgba(255,255,255,.22); }

/* ---------- PRIVATE CHAT: EFEK KABEL ---------- */
.pc-col { position: relative; }
.pc-cable { position: absolute; left: -1px; top: 0; bottom: 0; width: 3px; overflow: hidden; border-radius: 3px; pointer-events: none; z-index: 5; }
.pc-cable .pc-cable-pulse { position: absolute; left: 0; width: 100%; height: 55%; bottom: -60%; border-radius: 3px; background: linear-gradient(to top, transparent, var(--accent) 40%, var(--accent) 60%, transparent); box-shadow: 0 0 8px 1px var(--accent); opacity: 0; }
.pc-cable.active .pc-cable-pulse { animation: pcCableFlow 1s linear infinite; }
@keyframes pcCableFlow {
  0%   { bottom: -60%; opacity: 0; }
  12%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { bottom: 100%; opacity: 0; }
}
.pc-cable-r { left: auto; right: -1px; }
.pc-model-chip { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); font-size: 12px; font-weight: 700; cursor: pointer; }
.pc-model-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
#privateChatSendBtn:active { transform: scale(.92); }
#privateChatSendBtn:disabled { opacity: .35; cursor: default; }
#settingsModal.show { z-index: 220; }
.pc-input-wrap { position: relative; }
.pc-cable-h { position: absolute; left: 0; right: 0; top: -1px; height: 3px; overflow: hidden; border-radius: 3px; pointer-events: none; z-index: 5; }
.pc-cable-h .pc-cable-pulse-h { position: absolute; top: 0; height: 100%; width: 55%; right: -60%; border-radius: 3px; background: linear-gradient(to left, transparent, var(--accent) 40%, var(--accent) 60%, transparent); box-shadow: 0 0 8px 1px var(--accent); opacity: 0; }
.pc-cable-h.active .pc-cable-pulse-h { animation: pcCableFlowH 1s linear infinite; }
@keyframes pcCableFlowH {
  0%   { right: -60%; opacity: 0; }
  12%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { right: 100%; opacity: 0; }
}

@media (min-width: 900px) {
  #sidebar-scrim { display: none; }
}
@media (max-width: 899px) {
  #main { margin-left: 0; }
  #sidebar { transform: translateX(-102%); }
  #sidebar.open { transform: translateX(0); }
}

/* ---------- MULTI CHAT (BARU): canvas node yang bisa di-drag & di-pan, semua model unlocked jawab
   bareng dalam satu turn. Diadaptasi dari next_midnight.html, disesuaikan skema warna & variabel file ini.
   Menggantikan Multi Chat lama (2 AI Flash/Beta di halaman terpisah) yang sudah dihapus. ---------- */
.mchat-hero { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; flex: 1; gap: 16px; padding: 30px 20px 10px; text-align: center; }
.mchat-hero-title { font-size: 30px; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; background: linear-gradient(135deg, #7c5cf7, #a78bf5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mchat-hero-sub { font-size: 13px; color: var(--text-muted); margin-top: -6px; }
.mchat-hero-cards { display: flex; gap: 8px; width: 100%; max-width: 460px; flex-wrap: wrap; justify-content: center; }
.mchat-hero-card { flex: 1 1 0; min-width: 90px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mchat-hero-card .mhc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mc, #7c5cf7); }
.mchat-hero-card .mhc-name { font-size: 11px; font-weight: 700; color: var(--mc, #7c5cf7); letter-spacing: .01em; white-space: nowrap; }
.mchat-hero-hint { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 10px 18px; margin-top: 2px; }

.mchat-turn { padding: 10px 16px 4px; }
.mchat-canvas {
  position: relative; width: 100%; height: 58vh; min-height: 320px; overflow: hidden;
  border-radius: 16px; border: 1px solid var(--border); background-color: var(--surface);
  background-image: radial-gradient(var(--border2) 1.2px, transparent 1.2px);
  background-size: 20px 20px; touch-action: none; cursor: grab;
}
.mchat-canvas.panning { cursor: grabbing; }
.mchat-canvas-inner { position: absolute; top: 0; left: 0; transform-origin: 0 0; will-change: transform; }
svg.mchat-lines { position: absolute; top: 0; left: 0; overflow: visible; pointer-events: none; }
svg.mchat-lines path { fill: none; stroke-width: 2; stroke-dasharray: 5 6; opacity: .75; animation: mchatLineFlow .7s linear infinite; }
@keyframes mchatLineFlow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -22; } }

.mchat-node { position: absolute; touch-action: none; }
.mchat-node.dragging { z-index: 30; }
.mchat-user-node {
  background: var(--surface2); border: 1px solid var(--border2); border-radius: 12px;
  padding: 8px 14px; text-align: center; cursor: grab; box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.mchat-user-node:active { cursor: grabbing; }
.mchat-user-node .mun-tag { font-size: 9px; font-weight: 700; letter-spacing: .08em; color: var(--text-muted); }
.mchat-user-node .mun-text { font-size: 13px; color: var(--text); margin-top: 2px; word-break: break-word; }

.mchat-answer-node .mchat-answer-box { width: 100%; max-width: none; flex: none; margin: 0; box-shadow: 0 3px 14px rgba(0,0,0,.08); }
.mchat-answer-node .mchat-answer-head { cursor: grab; }
.mchat-answer-node .mchat-answer-head:active { cursor: grabbing; }
.mchat-answer-box {
  position: relative; border: 1px solid var(--border); border-top: 2px solid var(--mc, var(--border)); border-radius: 14px;
  background: var(--white); overflow: hidden; display: flex; flex-direction: column;
}
.mchat-node-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mc, var(--text-muted)); flex-shrink: 0; }
.mchat-answer-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px; font-size: 11px; font-weight: 800; color: var(--mc, var(--text)); background: color-mix(in srgb, var(--mc, var(--border)) 12%, transparent); }
.mchat-answer-body { padding: 11px 13px; font-size: 13px; line-height: 1.55; color: var(--text); max-height: 220px; overflow-y: auto; }
.mchat-answer-body.err { color: var(--danger); }
.mchat-answer-body .typing-dots { display: flex; gap: 4px; padding: 2px 0; }

.mchat-chip-row { display: none; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.mchip { font-size: 10.5px; font-weight: 700; color: var(--mc); background: color-mix(in srgb, var(--mc) 14%, transparent); border: 1px solid color-mix(in srgb, var(--mc) 40%, transparent); border-radius: 20px; padding: 4px 10px; }

.mchat-canvas-controls { display: none; position: absolute; top: 10px; right: 10px; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px; z-index: 15; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.mchat-canvas-controls button { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; color: var(--text-dim); border-radius: 8px; cursor: pointer; }
.mchat-canvas-controls button:hover { background: var(--surface2); color: var(--text); }
.mchat-canvas-controls button:first-child { border-bottom: 1px solid var(--border); border-radius: 8px 8px 0 0; }
body.mode-mchat #mchat-canvas-controls-wrap { display: flex; }
#newChatBtn.mchat-active-btn, .new-chat-btn.mchat-active-btn { outline: 2px solid #7c5cf7; outline-offset: -2px; }

/* ---------- MULTIMIND PAGE ---------- */
#multiMindPage .mm-header { background: linear-gradient(120deg, #f59e0b, #ef4444); flex: none; }
#multiMindPage .mm-header * { color: #fff !important; }
#multiMindPage .mm-header .icon-btn:hover { background: rgba(255,255,255,.18); }
#multiMindPage .mm-header .theme-swatch { border-color: rgba(255,255,255,.6); }
#multiMindSendBtn { background: linear-gradient(120deg, #f59e0b, #ef4444) !important; }
.mm-feed { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.mm-welcome { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 34px 16px; color: var(--text-muted); }
.mm-welcome-icon { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, rgba(245,158,11,.18), rgba(239,68,68,.18)); border: 1px solid rgba(245,158,11,.3); display: flex; align-items: center; justify-content: center; }
.mm-welcome-icon svg { width: 26px; height: 26px; stroke: #f59e0b; fill: none; stroke-width: 1.8; }
.mm-welcome-title { font-size: 16px; font-weight: 800; letter-spacing: .04em; background: linear-gradient(90deg, #f59e0b, #ef4444); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.mm-welcome-sub { font-size: 12.5px; max-width: 280px; line-height: 1.55; }
.mm-user-bubble { align-self: flex-end; max-width: 82%; flex-shrink: 0; background: var(--accent); color: var(--accent-fg); padding: 10px 14px; border-radius: 16px 16px 4px 16px; font-size: 13.5px; line-height: 1.5; }
.mm-wrap { display: flex; flex-direction: column; gap: 0; border-radius: 14px; overflow: hidden; border: 1px solid rgba(245,158,11,.28); animation: wscIn .3s ease both; flex-shrink: 0; }
.mm-wrap-hdr { display: flex; align-items: center; gap: 8px; padding: 9px 13px; background: rgba(245,158,11,.1); font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #d9860f; }
:root[data-theme] .mm-wrap-hdr { color: #f59e0b; }
.mm-wrap-hdr .mm-spin { width: 12px; height: 12px; border: 2px solid rgba(245,158,11,.3); border-top-color: #f59e0b; border-radius: 50%; animation: wscSpin .8s linear infinite; flex-shrink: 0; }
.mm-phases { display: flex; gap: 6px; padding: 8px 13px; background: var(--surface); flex-wrap: wrap; }
.mm2-phase-chip { padding: 3px 10px; border-radius: 20px; font-size: 10px; font-weight: 700; letter-spacing: .02em; border: 1px solid var(--border); color: var(--text-muted); transition: all .25s; }
.mm2-phase-chip.active { background: rgba(245,158,11,.16); border-color: rgba(245,158,11,.5); color: #f59e0b; animation: phaseGlow2 1s ease-in-out infinite; }
.mm2-phase-chip.done { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.4); color: #22c55e; }
@keyframes phaseGlow2 { 0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); } 50% { box-shadow: 0 0 8px rgba(245,158,11,.35); } }
.mm-cards-row { display: flex; gap: 8px; padding: 10px 13px; background: var(--surface); overflow-x: auto; }
.mm2-card { flex: 0 0 200px; width: 200px; border-radius: 12px; overflow: hidden; border: 1.5px solid var(--border2); background: var(--bg); transition: all .3s; }
.mm2-card.winner { transform: scale(1.03); box-shadow: 0 0 16px rgba(245,158,11,.4); border-color: rgba(245,158,11,.8); }
.mm2-card-hdr { display: flex; align-items: center; gap: 6px; padding: 7px 9px; font-size: 9.5px; font-weight: 800; letter-spacing: .05em; }
.mm2-cdot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.mm2-card-body { padding: 8px 9px; font-size: 11.5px; line-height: 1.55; max-height: 320px; overflow-y: auto; color: var(--text); }
.mm2-card-vote { padding: 6px 9px; border-top: 1px solid var(--border); font-size: 9.5px; font-weight: 700; letter-spacing: .02em; }
.mm2-winner-badge { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 10px; background: rgba(245,158,11,.2); border: 1px solid rgba(245,158,11,.4); color: #f59e0b; font-size: 8.5px; font-weight: 800; margin-left: 4px; }
.mm-debate-log { padding: 9px 13px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; max-height: 190px; overflow-y: auto; }
.mm2-de-entry { display: flex; gap: 8px; align-items: flex-start; font-size: 11.5px; line-height: 1.5; padding: 5px 8px; border-radius: 8px; background: var(--bg); border-left: 2px solid var(--border2); }
.mm2-de-meta { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; min-width: 54px; }
.mm2-de-label { font-size: 8.5px; font-weight: 800; letter-spacing: .03em; white-space: nowrap; }
.mm2-de-round { font-size: 7.5px; font-weight: 700; padding: 1px 5px; border-radius: 7px; background: rgba(245,158,11,.12); color: #d9860f; white-space: nowrap; }
.mm2-de-text { color: var(--text-dim); opacity: .9; }
.mm-voting-section { padding: 10px 13px; background: var(--surface); }
.mm-voting-title { font-size: 10px; font-weight: 800; letter-spacing: .08em; color: #d9860f; text-transform: uppercase; margin-bottom: 8px; }
.mm-voting-bars { display: flex; flex-direction: column; gap: 6px; }
.mm2-vote-row { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.mm2-vote-label { width: 76px; font-size: 10px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; }
.mm2-vote-track { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.mm2-vote-fill { height: 100%; border-radius: 3px; transition: width .6s ease; }
.mm2-vote-score { font-size: 10px; color: var(--text-muted); min-width: 14px; text-align: right; }
.mm-final-wrap { padding: 13px; background: rgba(245,158,11,.06); border-top: 1px solid rgba(245,158,11,.25); }
.mm-final-label { font-size: 10px; font-weight: 800; letter-spacing: .08em; color: #f59e0b; text-transform: uppercase; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.mm-final-label svg { width: 13px; height: 13px; fill: #f59e0b; }
.mm-final-content { font-size: 14px; line-height: 1.65; color: var(--text); }
.mm-final-meta { margin-top: 10px; font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--border); }
.mm2-winner-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 8px; font-size: 10px; font-weight: 800; }
.mm-vote-note { margin-top: 10px; padding: 9px 12px; background: rgba(245,158,11,.06); border: 1px solid rgba(245,158,11,.18); border-radius: 10px; font-size: 10.5px; color: var(--text-muted); line-height: 1.6; display: flex; gap: 7px; }
.mm-vote-note b { color: #d9860f; font-weight: 800; }
.mm-not-enough { padding: 14px; text-align: center; color: var(--text-muted); font-size: 12.5px; background: var(--surface); }
/* ================= PATCH PERFORMA SCROLL ================= */
/* Semua container yang bisa discroll: aktifkan momentum-scroll native di iOS,
   cegah scroll induk ikut ter-tarik (overscroll-behavior), dan beri browser
   "contain" supaya repaint/reflow di dalam container tidak memicu layout
   ulang ke seluruh halaman saat scroll berlangsung. */
#hist-list, #psHistList, #chat-scroll, #artifactGrid,
.think-float-body, .code-stream-body, .ps-actv-history, .app-grid,
.mchat-answer-body, .mm-feed, .mm2-card-body, .mm-debate-log,
#projectList, #privateChatOutA, #privateChatOutB,
[style*="overflow-y:auto"], [style*="overflow-y: auto"],
[style*="overflow:auto"], [style*="overflow: auto"] {
  -webkit-overflow-scrolling: touch;
}
#hist-list, #psHistList, #chat-scroll, #artifactGrid,
.think-float-body, .code-stream-body, .ps-actv-history, .app-grid,
.mchat-answer-body, .mm-feed, .mm2-card-body, .mm-debate-log,
#projectList, #privateChatOutA, #privateChatOutB {
  overscroll-behavior: contain;
  contain: paint;
  will-change: scroll-position;
}
/* #chat-scroll adalah area paling sering discroll (isi obrolan) — beri jalur
   render sendiri (compositor layer) supaya scroll di sini tidak ikut memicu
   sidebar/header/animasi lain untuk repaint di frame yang sama. */
#chat-scroll { transform: translateZ(0); }
/* Sidebar juga sering discroll riwayat chat sambil transisi buka/tutup —
   pastikan browser tahu ini elemen yang akan berubah, biar dipromosikan ke
   layer GPU sejak awal, bukan baru saat animasi jalan (mengurangi jank). */
#sidebar { will-change: transform; }
/* Tombol dengan efek tekan (:active{transform:scale()}) dipromosikan ke layer
   GPU sejak awal (bukan baru saat ditekan), supaya menekannya di tengah-tengah
   scroll tidak memicu "promotion cost" yang bikin scroll patah sesaat. */
.new-chat-btn, .mm-launch-btn, .think-label-badge, .prog-space-btn, .ps-actv-dur, .ps-sb-newchat, .pscc-btn.pscc-copy, .call-mic-perm-btn, .call-pill-btn, .call-txt-send, .call-ctrl-btn, #callMicMain, #callEndMain, .cc-btn.cc-copy-html, .app-chip, #privateChatSendBtn {
  will-change: transform;
}
