/* AI progress surfaces: compact, honest status UI for Supercomputer and analysis. */
.chat-msg.ai.ai-progress-message { align-items: flex-start; }
.ai-progress-message > .msg-avatar { display: none !important; }
.ai-progress-message > .msg-content {
  flex: 0 1 538px !important; width: min(538px, 100%); max-width: min(538px, 100%);
}
.ai-progress-card {
  width: 100%; overflow: hidden; color: var(--text-primary, #fff);
  border: 0; border-radius: 0; background: transparent; box-shadow: none;
}
.ai-progress-toggle {
  width: 100%; min-height: 32px; display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 16px; align-items: center; gap: 7px;
  padding: 0; color: var(--text-secondary, #b5b5ba); border: 0;
  background: transparent !important; border: 0 !important; border-radius: 0 !important;
  box-shadow: none !important; text-align: left; cursor: pointer;
}
.ai-progress-toggle::after { display: none !important; }
html body #viewChatfpl .ai-progress-card button.ai-progress-toggle {
  padding: 0 !important; color: var(--text-secondary, #b5b5ba) !important;
  background: transparent !important; border: 0 !important; border-radius: 0 !important;
  box-shadow: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
}
html body #viewChatfpl .ai-progress-card button.ai-progress-toggle::after { display: none !important; }
.ai-progress-mark {
  width: 16px; height: 16px; display: grid; place-items: center;
  color: currentColor; background: none; box-shadow: none;
}
.ai-progress-mark svg, .ai-progress-chevron svg, .ai-progress-step-icon svg {
  width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.ai-progress-heading { min-width: 0; }
.ai-progress-title { display: block; font-size: .875rem; font-weight: 450; letter-spacing: 0; }
.ai-progress-summary {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.ai-progress-chevron { color: var(--text-muted, #8a8a8e); transition: transform 180ms cubic-bezier(.22,1,.36,1); }
.ai-progress-toggle[aria-expanded="true"] .ai-progress-chevron { transform: rotate(180deg); }
.ai-progress-content { padding: 8px 0 0; display: flex; flex-direction: column; gap: 12px; }
.ai-progress-content[hidden] { display: none; }
.ai-progress-step {
  position: relative; display: grid; grid-template-columns: 16px minmax(0,1fr);
  gap: 7px; min-height: 20px; color: var(--text-muted, #8a8a8e);
  animation: ai-progress-enter 180ms cubic-bezier(.22,1,.36,1) both;
}
.ai-progress-step:not(:last-child)::before {
  content: ''; position: absolute; left: 7.5px; top: 25px; bottom: -12px; width: 1px;
  background: color-mix(in srgb, var(--border, #34343a) 88%, transparent);
}
.ai-progress-step-icon {
  position: relative; z-index: 1; width: 16px; height: 18px; display: grid; place-items: center;
  color: currentColor; border: 0; border-radius: 0; background: var(--pl-bg, #0a0a0b);
}
.ai-progress-step-body { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.ai-progress-step-label { padding: 0; font-size: .875rem; line-height: 1.45; }
.ai-progress-step.is-active { color: var(--text-primary, #fff); }
.ai-progress-step.is-active .ai-progress-step-icon {
  color: currentColor; border: 0; background: var(--pl-bg, #0a0a0b); box-shadow: none;
}
.ai-progress-step.is-complete { color: var(--text-secondary, #b5b5ba); }
.ai-progress-step.is-complete .ai-progress-step-icon {
  color: currentColor; border: 0; background: var(--pl-bg, #0a0a0b);
}
.ai-progress-results { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ai-progress-result {
  display: inline-flex; align-items: center; min-height: 20px; padding: 2px 9px;
  border-radius: 999px; background: var(--pl-card, #26262a); color: var(--text-primary, #fff);
  font-size: .7rem; font-weight: 650; line-height: 1.2;
}
.ai-progress-evidence {
  width: 100%; height: 174px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; border-radius: 12px; background: var(--pl-card, #26262a); padding: 12px;
}
.ai-progress-evidence-inner {
  width: min(400px, 88%); height: 100%; border: 1px solid color-mix(in srgb, var(--border, #44444a) 88%, transparent);
  border-radius: 8px; background: transparent;
}
.ai-progress-caption {
  margin: 0; color: var(--text-secondary, #b5b5ba); font-size: .72rem; line-height: 1.45;
}
.ai-thinking-row .msg-content {
  flex: 0 0 auto !important; width: auto !important; min-height: 0;
  display: flex; align-items: center; padding: 0 !important;
  border: 0 !important; border-radius: 0 !important;
  background: transparent !important; box-shadow: none !important;
}
.ai-thinking-row > .msg-avatar { display: none !important; }
.ai-thinking-row .msg-content::after { display: none !important; }
.thinking-orb-status {
  display: inline-flex; min-height: 64px; align-items: center; gap: 15px;
  color: var(--text-secondary, #c7c7cb);
}
.thinking-orb-canvas {
  display: block; width: 64px; height: 64px; flex: 0 0 64px;
  color: currentColor;
}
.thinking-orb-canvas.is-fallback {
  border: 1px solid currentColor; border-radius: 50%; opacity: .7;
  animation: thinking-orb-fallback 1.8s ease-in-out infinite;
}
.thinking-orb-label { font-size: 1rem; font-weight: 560; letter-spacing: -.01em; }

/* Libraries.dev Border Beam treatment for both Supercomputer composers. */
.chat-composer,
.planner-composer {
  --sc-beam-angle: 0deg;
  position: relative !important;
  isolation: isolate;
}
.chat-composer::before,
.planner-composer::before {
  content: '';
  position: absolute;
  z-index: 3;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  opacity: .48;
  background: conic-gradient(from var(--sc-beam-angle),
    transparent 0 68%, #c21500 76%, #ffc500 82%, #22d3ee 88%, #5eead4 92%, transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: sc-border-beam 4.8s linear infinite;
  transition: opacity 180ms cubic-bezier(.16,1,.3,1);
}
.chat-composer:focus-within::before,
.planner-composer:focus-within::before { opacity: .76; animation-duration: 3.2s; }
.chat-composer.is-thinking::before,
.planner-composer.is-thinking::before { opacity: .94; animation-duration: 2.25s; }
.chat-composer.is-dictating::before,
.chat-composer.is-transcribing::before {
  opacity: 0 !important;
  animation: none !important;
}
:root.light-mode .chat-composer::before,
:root.light-mode .planner-composer::before { opacity: .6; }

/* The expandable progress card is the research indicator now. Keep the old
   composer status nodes out of layout so users do not see two competing waits. */
#researchStatus,
#plannerResearchStatus { display: none !important; }

/* GridReveal analysis dialog */
.loading-overlay {
  padding: 18px; background: rgba(5,5,6,.82) !important;
  backdrop-filter: blur(18px) saturate(.85) !important;
  -webkit-backdrop-filter: blur(18px) saturate(.85) !important;
}
.loading-card.grid-reveal-card {
  width: min(590px, calc(100vw - 36px)); max-height: calc(100dvh - 36px); overflow: auto;
  padding: 12px 12px 18px; text-align: left; border-radius: 22px !important;
  background: color-mix(in srgb, var(--pl-card, #171719) 94%, transparent) !important;
  border: 1px solid rgba(255,255,255,.1) !important;
  box-shadow: 0 30px 90px -38px rgba(0,0,0,.95), inset 0 1px rgba(255,255,255,.05) !important;
}
.grid-reveal-frame {
  position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 14px;
  background: #111113; border: 1px solid rgba(255,255,255,.07);
}
.grid-reveal-frame::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.05), transparent 24%, transparent 76%, rgba(0,0,0,.25));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
}
#gridRevealCanvas { width: 100%; height: 100%; display: block; }
.grid-reveal-brand {
  position: absolute; left: 12px; top: 12px; z-index: 1; display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 9px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px;
  color: rgba(255,255,255,.88); background: rgba(10,10,11,.58); backdrop-filter: blur(10px);
  font-family: 'JetBrains Mono', monospace; font-size: .58rem; font-weight: 760;
  letter-spacing: .06em; text-transform: uppercase;
}
.grid-reveal-brand::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: linear-gradient(135deg, #c21500, #ffc500); box-shadow: 0 0 12px rgba(255,197,0,.7);
}
.grid-reveal-copy { padding: 16px 8px 2px; }
.grid-reveal-copy .loading-title { margin: 0 0 5px; font-size: 1rem; line-height: 1.25; }
.grid-reveal-copy .loading-sub {
  min-height: 1.25em; margin: 0 0 14px; color: var(--text-secondary, #b5b5ba); font-size: .78rem;
}
.grid-reveal-copy .loading-sub::after {
  content: ''; display: inline-block; width: 1.2em; height: .9em; margin-left: .3em; vertical-align: -.12em;
  background: linear-gradient(90deg, transparent, rgba(255,197,0,.95), transparent);
  background-size: 200% 100%; animation: grid-caption-shimmer 1.35s linear infinite;
}
.grid-reveal-copy .progress-bar { height: 2px; margin: 0; background: rgba(255,255,255,.07); }
.grid-reveal-copy .progress-fill {
  background: linear-gradient(90deg, #c21500, #ffc500); box-shadow: 0 0 16px rgba(255,197,0,.25);
}
.grid-reveal-card .loading-steps {
  position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important;
  margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important;
  white-space: nowrap !important; border: 0 !important;
}
:root.light-mode .loading-overlay { background: rgba(246,244,239,.82) !important; }
:root.light-mode .loading-card.grid-reveal-card { background: rgba(255,255,255,.94) !important; border-color: rgba(20,18,15,.12) !important; }
:root.light-mode .ai-progress-card { background: transparent !important; }

/* Elite Meta now uses the same full-width rail language as My Team. */
#eliteMetaSubNav.elite-meta-subnav { margin: 0 20px 20px; }
#eliteMetaSubNav .rsnav-btn { min-height: 50px; }

@property --sc-beam-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes sc-border-beam { to { --sc-beam-angle: 360deg; } }
@keyframes thinking-orb-fallback {
  0%,100% { transform: scale(.9); opacity: .45; }
  50% { transform: scale(1); opacity: .8; }
}
@keyframes ai-progress-pulse {
  0%,100% { transform: scale(1); box-shadow: 0 0 0 3px rgba(255,197,0,.06); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(255,197,0,.02); }
}
@keyframes ai-progress-enter {
  from { opacity: .35; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes grid-caption-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (max-width: 720px) {
  .loading-overlay { padding: 10px; }
  .loading-card.grid-reveal-card {
    width: min(100%, 430px); max-height: calc(100dvh - 20px); padding: 9px 9px 14px;
    border-radius: 18px !important;
  }
  .grid-reveal-frame { border-radius: 11px; }
  .grid-reveal-copy { padding: 13px 6px 1px; }
  .grid-reveal-copy .loading-title { font-size: .92rem; }
  .ai-progress-card { border-radius: 0; }
  .ai-progress-toggle { min-height: 44px; padding: 0; }
  .ai-progress-content { padding: 8px 0 0; }
  .ai-progress-evidence { height: 136px; }
  .thinking-orb-status { min-height: 56px; gap: 12px; }
  .thinking-orb-canvas { width: 56px !important; height: 56px !important; flex-basis: 56px; }
  #eliteMetaSubNav.elite-meta-subnav { margin: 0 8px 16px; overflow-x: auto; scrollbar-width: thin; }
  #eliteMetaSubNav.elite-meta-subnav .rsnav-btn { flex: 1 0 142px !important; }
}
@media (prefers-reduced-motion: reduce) {
  .ai-progress-chevron, .ai-progress-step-icon,
  .grid-reveal-copy .loading-sub::after {
    animation: none !important; transition: none !important; transform: none !important;
  }
  .chat-composer::before, .planner-composer::before { animation: none !important; opacity: .45; }
  .thinking-orb-canvas.is-fallback { animation: none !important; }
}
