/* LOADING_UI_V2 (11-11, Dimas): wait state = one status line (logo + shimmer label + seconds),
   sources = favicon stack pill, process folds into one grey line at the first answer token.
   Replaces the skeleton bars and the Analyze/Search/Compose rail. Every rule is scoped to html.ld2.
   Kill: LD2_ON=false in chat.html (all users) or ?ld2=0 (this browser; ?ld2=1 clears). */

/* --- status line (placeholder + agentic live row) --- */
html.ld2 .m-txt > .typing { flex-direction: row; align-items: center; gap: 0; padding: 4px 0; }
html.ld2 .ld2-st { display: inline-flex; align-items: center; gap: 10px; min-width: 0; max-width: 100%; }
html.ld2 .ld2-av { width: 22px; height: 22px; flex: none; border-radius: 50%; animation: ld2Breathe 2.4s ease-in-out infinite; }
html.ld2 .ld2-av.sm { width: 16px; height: 16px; animation: none; opacity: .75; }
@keyframes ld2Breathe { 0%, 100% { transform: scale(1) rotate(0deg); opacity: .85; } 50% { transform: scale(1.08) rotate(45deg); opacity: 1; } }

html.ld2 .ld2-lbl,
html.ld2 .agentic-live-row.searching .agentic-label {
  font-size: 14px; font-weight: 500;
  background: linear-gradient(90deg, var(--tx-3) 0%, var(--tx-3) 35%, var(--tx) 50%, var(--tx-3) 65%, var(--tx-3) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: ld2Shine 2.2s linear infinite;
}
@keyframes ld2Shine { from { background-position: 125% 0; } to { background-position: -125% 0; } }
html.ld2 .ld2-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
html.ld2 .ld2-tm { flex: none; color: var(--tx-3); font-size: 13px; font-variant-numeric: tabular-nums; }
html.ld2 .ld2-tm:empty { display: none; }

html.ld2 .agentic-live-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
html.ld2 .agentic-live-row .agentic-label { flex: 0 1 auto; }
html.ld2 .agentic-live-row.error .agentic-label { font-size: 14px; }
html.ld2 .agentic-phases { display: none; }
html.ld2 .agentic-indicator { gap: 8px; }
/* the agentic row is the status now; the placeholder line under it would say the same thing twice */
html.ld2 .msg.agentic-active .m-txt > .typing { display: none; }
/* a visible live-reasoning panel already shows the logo + progress */
html.ld2 .msg.assistant:has(#thinkInd #reasonLiveSteps:not(:empty)) .m-txt > .typing { display: none; }
/* the word fade (GEMINI_STREAM_REVEAL_V4) already shows text arriving; the cursor stays in the DOM (render logic reads it) */
html.ld2 .m-txt .streaming-cursor { display: none !important; }

/* --- favicon circles --- */
html.ld2 .ld2-fav { width: 20px; height: 20px; border-radius: 50%; overflow: hidden; display: inline-grid; place-items: center; flex: none;
  background: var(--bg-3); color: var(--tx-2); font-size: 9px; font-weight: 600; line-height: 1; }
html.ld2 .ld2-fav img { width: 100%; height: 100%; object-fit: cover; display: block; }
html.ld2 .ld2-fav .fav-letter { width: 100%; height: 100%; background: transparent !important; font-size: inherit; }
html.ld2 .ld2-fav .fav-pending { display: none; }
html.ld2 .ld2-stack { display: inline-flex; }
html.ld2 .ld2-stack .ld2-fav { margin-left: -6px; border: 2px solid var(--bg-2); animation: ld2Pop .35s cubic-bezier(.16, 1, .3, 1) both; }
html.ld2 .ld2-stack .ld2-fav:first-child { margin-left: 0; }
@keyframes ld2Pop { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* --- live sources pill --- */
html.ld2 .ld2-src { display: flex; flex-direction: column; gap: 6px; margin-left: 32px; min-width: 0; }
html.ld2 .ld2-pill { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; max-width: 100%;
  border: 1px solid var(--brd); background: var(--bg-2); border-radius: 999px; padding: 3px 11px 3px 4px;
  font: inherit; font-size: 12.5px; color: var(--tx-2); cursor: pointer; }
html.ld2 .ld2-pill:hover { color: var(--tx); }

/* --- folded trace (stays above the answer) --- */
html.ld2 .ld2-trace { display: flex; flex-direction: column; gap: 6px; margin: 0 0 8px; min-width: 0; animation: fadeIn .3s ease; }
html.ld2 .ld2-proc { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; max-width: 100%;
  background: none; border: 0; padding: 2px 0; font: inherit; font-size: 13px; color: var(--tx-3); cursor: pointer; }
html.ld2 .ld2-proc:hover { color: var(--tx-2); }
html.ld2 .ld2-proc .ld2-fav { width: 16px; height: 16px; font-size: 8px; border-color: var(--bg-0); animation: none; }
html.ld2 .ld2-chev { width: 13px; height: 13px; flex: none; transition: transform .2s; }
html.ld2 .ld2-trace.open .ld2-chev { transform: rotate(90deg); }

/* --- expanded source list (pill + trace) --- */
html.ld2 .ld2-list { display: none; flex-direction: column; gap: 2px; border-left: 2px solid var(--brd-2); margin-left: 8px; padding: 2px 0 2px 12px; max-width: 560px; min-width: 0; }
html.ld2 .ld2-src.open .ld2-list, html.ld2 .ld2-trace.open .ld2-list { display: flex; }
html.ld2 .ld2-row { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 2px 0; font-size: 13px; color: var(--tx-2); text-decoration: none; }
html.ld2 .ld2-row:hover { color: var(--tx); text-decoration: underline; }
html.ld2 .ld2-row > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
html.ld2 .ld2-row .ld2-fav { width: 16px; height: 16px; font-size: 8px; }

@media (max-width: 768px) {
  html.ld2 .ld2-src { margin-left: 0; }
  html.ld2 .ld2-lbl, html.ld2 .agentic-live-row.searching .agentic-label { font-size: 13.5px; }
}
@media (prefers-reduced-motion: reduce) {
  html.ld2 .ld2-av, html.ld2 .ld2-stack .ld2-fav, html.ld2 .ld2-trace { animation: none; }
  html.ld2 .ld2-lbl, html.ld2 .agentic-live-row.searching .agentic-label { animation: none; background: none; color: var(--tx-2); }
}
