/* Starman's avatar spots (<starman-avatar>, defined by /avatar/boot.js): sized before the
   definition arrives (the markup writes width/height inline), so nothing moves when it does. */
starman-avatar { display: block; flex: none; border-radius: 50%; overflow: hidden; }

/* ── Starman Desktop Window UI (macOS inspired) ── */

.content.starman-active {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.starman-viewport-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 120px);
  padding: 0.5rem;
  box-sizing: border-box;
}

/* Outer Window Frame */
.starman-app-window {
  display: flex;
  width: 100%;
  max-width: 1100px;
  height: min(780px, calc(100vh - 130px));
  min-height: 600px;
  background: #ffffff;
  border-radius: 26px;
  box-shadow: 0 25px 70px -15px rgba(0, 0, 0, 0.25), 
              0 0 0 1px rgba(0, 0, 0, 0.07);
  overflow: hidden;
  position: relative;
  margin: 0 auto;
  color: #0f172a;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Fullscreen Window Mode */
.starman-app-window.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  border-radius: 0;
  z-index: 99999;
  box-shadow: none;
}

/* ── Sidebar (Left Column) ── */
.starman-sidebar {
  width: 200px;
  background: #f8fafc;
  border-right: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.85rem;
  flex-shrink: 0;
  user-select: none;
}

.starman-sidebar-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  padding-left: 0.35rem;
  position: relative;
}

/* macOS Window Traffic Light Dots */
.starman-window-dots {
  display: flex;
  align-items: center;
  gap: 7px;
}

.starman-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-block;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.starman-dot:hover {
  transform: scale(1.15);
  filter: brightness(0.9);
}

.starman-dot-red {
  background: #ff5f56;
  border: 1px solid #e0443e;
}

.starman-dot-yellow {
  background: #ffbd2e;
  border: 1px solid #dea123;
}

.starman-dot-green {
  background: #27c93f;
  border: 1px solid #1aab29;
}

/* Universe Selector Pill next to dots */
.starman-universe-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  background: transparent;
  border: none;
  outline: none;
  transition: background 0.15s ease;
}

.starman-universe-btn:hover {
  background: #e2e8f0;
}

.starman-universe-btn svg {
  width: 14px;
  height: 14px;
  color: #64748b;
  stroke-width: 2.5;
}

/* Starman Universe Dropdown */
.starman-universe-popover {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  width: 240px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  z-index: 100;
  padding: 6px;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.starman-universe-popover.open {
  display: block;
}

.starman-universe-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  color: #1e293b;
  transition: background 0.15s;
}

.starman-universe-option:hover {
  background: #f1f5f9;
}

.starman-universe-option.active {
  background: #eef4ff;
  color: #2563eb;
  font-weight: 600;
}

/* Navigation List */
.starman-nav-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.starman-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
  text-decoration: none;
  outline: none;
}

.starman-nav-item svg {
  width: 18px;
  height: 18px;
  color: #64748b;
  stroke-width: 2;
  transition: color 0.15s ease;
}

.starman-nav-item:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.starman-nav-item:hover svg {
  color: #1e293b;
}

.starman-nav-item.active {
  background: #eef4ff;
  color: #2563eb;
  font-weight: 600;
}

.starman-nav-item.active svg {
  color: #2563eb;
}

.starman-nav-badge {
  margin-left: auto;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
}

/* Sidebar Footer */
.starman-sidebar-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Main Content Area ── */
.starman-main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

/* Top Header */
.starman-top-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.85rem 1.75rem 0.25rem;
  gap: 1rem;
  z-index: 20;
  position: relative;
}

.starman-search-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border-radius: 9999px;
  padding: 10px 20px;
  width: 400px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: all 0.25s ease;
  border: 1px solid #f1f5f9;
}

.starman-search-pill:focus-within {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
  width: 440px;
}

.starman-search-pill svg {
  width: 18px;
  height: 18px;
  color: #94a3b8;
}

.starman-search-pill input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.95rem;
  color: #1e293b;
  width: 100%;
  font-family: inherit;
  font-weight: 500;
}

.starman-search-pill input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.starman-shortcut-badge {
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, monospace;
  color: #64748b;
  background: #f1f5f9;
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
  white-space: nowrap;
}

.starman-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.starman-user-avatar:hover {
  transform: scale(1.05);
}

/* ── Hero View Content ── */
.starman-hero-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 140px 1.5rem 1.5rem;
  overflow-y: auto;
  position: relative;
  scrollbar-width: thin;
}

.starman-hero-img-wrapper {
  position: relative;
  width: 100%;
  max-width: 580px;
  height: 260px;
  margin-top: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.starman-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
  pointer-events: none;
  user-select: none;
  border-radius: 0; /* the hero is a <starman-avatar> on a wide stage, not a circle */
  mask-image: radial-gradient(ellipse 48% 48% at center, rgba(0,0,0,1) 40%, rgba(0,0,0,0) 98%);
  -webkit-mask-image: radial-gradient(ellipse 48% 48% at center, rgba(0,0,0,1) 40%, rgba(0,0,0,0) 98%);
}

.starman-headline {
  margin-top: 24px;
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: #0f172a;
  text-align: center;
  line-height: 1.2;
}

.starman-brand-highlight {
  color: #2563eb;
}

/* Night: the greeting in the page's own text colour (the dark ink above vanishes on a dark page),
   and Starman's name a lighter blue that still reads */
[data-theme="dark"] .starman-headline,
:root:not([data-theme="light"]) .starman-headline {
  color: var(--text-main);
}
[data-theme="dark"] .starman-brand-highlight,
:root:not([data-theme="light"]) .starman-brand-highlight {
  color: #60a5fa;
}

.starman-subtitle {
  font-size: 1.05rem;
  color: #64748b;
  font-weight: 500;
  margin-top: 6px;
  text-align: center;
  letter-spacing: -0.01em;
}

/* Input Bar (Central Pill) */
.starman-input-box {
  margin-top: 1.35rem;
  width: 100%;
  max-width: 600px;
  position: relative;
}

.starman-input-pill {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 9999px;
  padding: 6px 8px 6px 14px;
  box-shadow: 0 6px 25px -4px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  transition: all 0.25s ease;
}

.starman-input-pill:focus-within {
  border-color: #2563eb;
  box-shadow: 0 8px 30px -4px rgba(37, 99, 235, 0.15), 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.starman-pill-plus {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
}

.starman-pill-plus:hover {
  color: #1e293b;
  background: #f1f5f9;
}

.starman-pill-plus svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.starman-pill-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  padding: 8px 12px;
  font-size: 1rem;
  color: #0f172a;
  font-family: inherit;
}

.starman-pill-input::placeholder {
  color: #94a3b8;
  font-weight: 400;
}

.starman-pill-mic-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.starman-pill-mic-btn:hover {
  background: #1d4ed8;
  transform: scale(1.04);
}

.starman-pill-mic-btn:active {
  transform: scale(0.96);
}

.starman-pill-mic-btn svg {
  width: 20px;
  height: 20px;
}

/* Voice pulse animation when listening */
.starman-pill-mic-btn.listening {
  background: #ef4444;
  box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.25);
  animation: pulse-mic 1.5s infinite;
}

@keyframes pulse-mic {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Mode Toggles (Write / Talk) */
.starman-mode-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 1rem;
}

.starman-mode-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 18px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
}

.starman-mode-pill.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.starman-mode-pill:not(.active) {
  background: #f1f5f9;
  color: #475569;
}

.starman-mode-pill:not(.active):hover {
  background: #e2e8f0;
  color: #1e293b;
}

.starman-mode-pill svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

/* Quick Action Cards Grid */
.starman-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 960px;
  margin-top: 1.4rem;
  padding-bottom: 0.5rem;
}

.starman-quick-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  text-align: left;
  outline: none;
}

.starman-quick-card:hover {
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.05);
}

.starman-quick-card:active {
  transform: translateY(0);
}

.starman-card-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #eff6ff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.starman-card-icon-box svg {
  width: 18px;
  height: 18px;
  color: #2563eb;
  stroke-width: 2.2;
}

.starman-card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  font-size: 0.82rem;
  line-height: 1.25;
  color: #475569;
}

.starman-card-text strong {
  color: #0f172a;
  font-weight: 700;
}

.starman-card-arrow {
  color: #94a3b8;
  width: 14px;
  height: 14px;
  stroke-width: 2.5;
  flex-shrink: 0;
}

/* ── Chat History & Conversation View ── */
.starman-chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: visible;
}

/* The avatar beside an answer (views/starman.js rowAvatarHtml): a 48 px column. The newest answer's is
   all of Starman (84 x 120, live 3D where the device allows), standing out of the column so the cards
   keep their place, and drawn over the card's edge when a hand reaches it. */
.starman-row-avatar {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  z-index: 2;
}
.starman-row-live {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 84px;
  height: 120px;
  margin-left: -42px;
  pointer-events: none;
}

.starman-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 135px 12% 100px 12%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  scroll-behavior: smooth;
  scrollbar-width: thin;
}

/* User Message */
.starman-user-row-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: 100%;
}

.starman-user-row {
  display: inline-flex;
  align-items: flex-end;
  position: relative;
  max-width: 85%;
}

.starman-user-bubble {
  position: relative;
  background: #bbf7d0;
  border: none;
  color: #14532d;
  padding: 16px 28px;
  border-radius: 32px 28px 0px 32px;
  line-height: 1.45;
  font-size: 1.08rem;
  font-weight: 500;
  box-shadow: 0 4px 15px rgba(22, 163, 74, 0.08);
  word-break: break-word;
}

/* Bot Message */
.starman-bot-row {
  display: flex;
  justify-content: flex-start;
  width: 100%;
}

.starman-bot-wrapper {
  display: flex;
  gap: 1rem;
  max-width: 100%;
}

.starman-bot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid #e2e8f0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  object-fit: cover;
  background: #ffffff;
}

.starman-bot-body {
  flex: 1;
  padding-top: 4px;
  line-height: 1.7;
  color: #1e293b;
  font-size: 1.02rem;
  min-width: 0;
  word-break: break-word;
}

.starman-bot-body strong {
  font-weight: 600;
  color: #0f172a;
}

.starman-bot-body a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Starman's answer (views/answerMarkdown.js): blocks are spaced by their margins, never by runs of <br> */
.sa-p { margin: 0 0 12px; }
.sa-h {
  margin: 20px 0 8px;
  color: #0f172a;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.sa-h:first-child { margin-top: 0; }
.sa-h1 { font-size: 1.3rem; }
.sa-h2 { font-size: 1.16rem; }
.sa-h3 { font-size: 1.08rem; }
.sa-list { margin: 0 0 12px; padding-left: 1.4em; }
.sa-list li { margin: 4px 0; padding-left: 2px; }
.sa-list li::marker { color: #94a3b8; }
ol.sa-list li::marker { color: #64748b; font-variant-numeric: tabular-nums; }
.sa-list .sa-list { margin: 4px 0 0; }
.sa-quote {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-left: 3px solid #93c5fd;
  border-radius: 0 10px 10px 0;
  background: #f8fafc;
  color: #334155;
}
.sa-quote > :last-child { margin-bottom: 0; }
.sa-rule { margin: 16px 0; border: 0; border-top: 1px solid #e2e8f0; }
.sa-code {
  margin: 0 0 12px;
  padding: 12px 14px;
  overflow-x: auto;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.86rem;
}
:is(.sa-p, .sa-list, .sa-quote, .sa-table) code {
  padding: 1px 6px;
  border-radius: 6px;
  background: #f1f5f9;
  font-size: 0.9em;
}
.sa-figure { margin: 0 0 12px; }
.sa-img { display: block; max-width: min(100%, 360px); max-height: 320px; object-fit: contain; border-radius: 12px; }
.sa-table-wrap { margin: 0 0 12px; overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 10px; }
.sa-table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
.sa-table th,
.sa-table td { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; text-align: left; vertical-align: top; }
.sa-table th { background: #f8fafc; color: #0f172a; font-weight: 600; }
.sa-table tr:last-child td { border-bottom: 0; }

/* A citation marker: a small number that takes you to its source under the answer */
.sa-cite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin: 0 1px 0 3px;
  padding: 0 5px;
  border: 0;
  border-radius: 9px;
  background: #e0e7ff;
  color: #3730a3;
  font: 600 0.7rem/1 'Inter', sans-serif;
  font-variant-numeric: tabular-nums;
  vertical-align: 0.15em;
  cursor: pointer;
  transition: background-color 150ms ease, transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.sa-cite:active { transform: scale(0.92); }
.sa-cite:focus-visible { outline: 2px solid #6366f1; outline-offset: 1px; }
.sa-cite--pending { background: #f1f5f9; color: #64748b; cursor: default; }
@media (hover: hover) {
  button.sa-cite:hover { background: #c7d2fe; }
}

/* The sources under an answer (views/sourceCards.js) */
.sa-sources { margin-top: 18px; padding-top: 14px; border-top: 1px solid #f1f5f9; }
.sa-sources-label {
  margin-bottom: 10px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sa-sources-list { display: flex; flex-direction: column; gap: 10px; }
.sa-src {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #ffffff;
  transition: border-color 150ms ease, box-shadow 250ms ease, background-color 150ms ease;
}
.sa-src.is-flash { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16); }
.sa-src--card { padding: 12px 14px; }
.sa-src--line { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: inherit; }
.starman-bot-body a.sa-src--line { color: inherit; text-decoration: none; }
.sa-src-head { display: flex; align-items: center; gap: 10px; }
.sa-src-avatar { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: #f1f5f9; object-fit: cover; }
.sa-src-avatar--icon { display: grid; place-items: center; color: #64748b; }
.sa-src-avatar--icon svg { width: 16px; height: 16px; }
.sa-src-meta { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.3; }
.sa-src-name,
.sa-src-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-src-name { color: #0f172a; font-size: 0.9rem; font-weight: 600; }
.sa-src-sub { color: #64748b; font-size: 0.78rem; }
.sa-src-n {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.starman-bot-body a.sa-src-open { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: #94a3b8; }
.sa-src-open svg { width: 15px; height: 15px; }
.sa-src-title { margin-top: 10px; color: #0f172a; font-size: 0.92rem; font-weight: 600; }
.sa-src-text {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  color: #475569;
  font-size: 0.88rem;
  line-height: 1.55;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.sa-media { margin-top: 12px; }
.sa-media--row { display: flex; gap: 8px; padding-bottom: 4px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.sa-media-item {
  display: block;
  flex-shrink: 0;
  position: relative;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: #f1f5f9;
  cursor: zoom-in;
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}
.sa-media-item:active { transform: scale(0.98); }
.sa-media-item:focus-visible { outline: 2px solid #6366f1; outline-offset: 2px; }
.sa-media-item img,
.sa-media-item video { display: block; width: 100%; height: 100%; object-fit: cover; }
.sa-media--one .sa-media-item { width: min(100%, 340px); max-height: 420px; aspect-ratio: 1; }
.sa-media--row .sa-media-item { width: 132px; height: 132px; aspect-ratio: auto !important; scroll-snap-align: start; }
.sa-media-item--video { background: #000000; cursor: default; }
@media (hover: hover) {
  .starman-bot-body a.sa-src--line:hover { border-color: #cbd5e1; background: #f8fafc; }
  .starman-bot-body a.sa-src-open:hover { background: #eff6ff; color: #2563eb; }
}

/* "Want to know more?": the answer's follow-up questions */
.starman-follow-up {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  background: #ffffff;
  color: #475569;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.starman-follow-up:active { transform: scale(0.97); }
@media (hover: hover) {
  .starman-follow-up:hover { border-color: #cbd5e1; background: #f8fafc; }
}

/* Sticky Input at bottom of chat */
.starman-bottom-input-container {
  padding: 1rem 12% 1.5rem;
  background: transparent;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

/* "Find what I can do": the last tile, a link to the Ideas page */
a.starman-quick-card { text-decoration: none; color: inherit; }
.starman-quick-card--discover .starman-card-icon-box {
  background: #2563eb;
}

.starman-quick-card--discover .starman-card-icon-box svg {
  color: #ffffff;
}


/* Responsive Styles */
@media (max-width: 1100px) {
  .starman-cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .starman-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .starman-app-window {
    height: calc(100vh - 100px);
  }
}

@media (max-width: 680px) {
  .starman-sidebar {
    width: 60px;
    padding: 1rem 0.5rem;
  }
  .starman-nav-item span,
  .starman-universe-btn span,
  .starman-sidebar-footer span {
    display: none;
  }
  .starman-cards-grid {
    grid-template-columns: 1fr;
  }
  .starman-search-pill {
    display: none;
  }
}

/* ── Starman Header Celestial Banner & Video Avatar ── */
.starman-header-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 125px;
  background-image: url('assets/earth_horizon_header.png');
  background-repeat: no-repeat;
  background-position: center top;
  background-size: 100% 100%;
  pointer-events: none;
  z-index: 1;
  display: none;
  transition: opacity 0.3s ease;
}

.starman-header-avatar {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 10;
  display: none;
  pointer-events: auto;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.starman-avatar-pill-wrapper {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 3.5px solid #ffffff;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.25), 0 2px 10px rgba(0, 0, 0, 0.08);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.starman-avatar-pill-wrapper:hover {
  transform: scale(1.05);
}

.starman-avatar-video-crop {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  background: #ffffff;
}

.starman-avatar-video-crop starman-avatar { border-radius: 50%; background: #ffffff; }

.starman-avatar-video-crop video {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 25%;
  transform: scale(1.35);
  display: block;
  background: #ffffff;
}

.starman-avatar-status-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background-color: #2563eb;
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  z-index: 15;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* ── Header Action Buttons (History, Docs, Settings) ── */
.starman-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-circle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-surface, #ffffff);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
  outline: none;
}

.header-circle-btn:hover {
  background: #f8fafc;
  color: #0f172a;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.header-circle-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

/* ── Custom Sweeping Tail for User Chat Bubble ── */
.starman-user-tail {
  position: absolute;
  right: -46px;
  bottom: 0;
  width: 48px;
  height: 44px;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════════
   STARMAN LIBRARY MODAL — Exact match to reference UI
   ══════════════════════════════════════════════════════════════════ */
.sl-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.sl-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.sl-modal-container {
  width: 1050px;
  max-width: 95vw;
  height: 680px;
  max-height: 90vh;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #0f172a;
}

.sl-modal-overlay.open .sl-modal-container {
  transform: scale(1);
}

/* Header */
.sl-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: #ffffff;
}

.sl-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sl-header-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  flex-shrink: 0;
}

.sl-header-title-box {
  display: flex;
  flex-direction: column;
}

.sl-header-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.sl-header-subtitle {
  margin: 3px 0 0 0;
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 400;
}

.sl-header-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #64748b;
  transition: all 0.15s ease;
}

.sl-header-close-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* Modal Body */
.sl-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  background: #ffffff;
}

/* Left Sidebar */
.sl-sidebar {
  width: 275px;
  flex-shrink: 0;
  border-right: 1px solid #f1f5f9;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 1rem 0.75rem;
  gap: 0.35rem;
}

.sl-platform-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  gap: 0.85rem;
  user-select: none;
}

.sl-platform-item:hover {
  background: #f8fafc;
}

.sl-platform-item.active {
  background: #ffffff;
}

.sl-platform-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: #22c55e;
}

.sl-platform-item[data-platform="instagram"].active::before { background: #E1306C; }
.sl-platform-item[data-platform="linkedin"].active::before { background: #0A66C2; }
.sl-platform-item[data-platform="web"].active::before { background: #FBBC05; }
.sl-platform-item[data-platform="whatsapp"].active::before { background: #25D366; }
.sl-platform-item[data-platform="telegram"].active::before { background: #2AABEE; }
.sl-platform-item[data-platform="discord"].active::before { background: #7289DA; }
.sl-platform-item[data-platform="youtube"].active::before { background: #FF0000; }
.sl-platform-item[data-platform="pdf"].active::before { background: #EF4444; }
.sl-platform-item[data-platform="others"].active::before { background: #64748B; }

.sl-platform-icon-wrap {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sl-platform-text-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.sl-platform-name {
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.25;
}

.sl-platform-desc {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sl-platform-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 9999px;
  margin-left: auto;
  flex-shrink: 0;
}

/* Right Content Area */
.sl-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 1.75rem 2rem 1.5rem 2rem;
  background: #ffffff;
}

/* Content Header */
.sl-content-top {
  display: flex;
  align-items: flex-start;
  gap: 1.15rem;
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}

.sl-content-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sl-content-title-cluster {
  display: flex;
  flex-direction: column;
}

.sl-content-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sl-content-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.2;
}

.sl-content-badge {
  background: #eff6ff;
  color: #2563eb;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 9999px;
  border: 1px solid #dbeafe;
}

.sl-content-desc {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.45;
  margin: 4px 0 0 0;
}

/* Search & Filter Row */
.sl-filter-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-shrink: 0;
}

.sl-search-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.sl-search-icon {
  position: absolute;
  left: 14px;
  width: 17px;
  height: 17px;
  color: #94a3b8;
  pointer-events: none;
}

.sl-search-input {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 0 14px 0 40px;
  font-size: 0.88rem;
  color: #0f172a;
  outline: none;
  transition: all 0.15s ease;
  font-family: inherit;
}

.sl-search-input:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sl-filter-dropdown-wrap {
  position: relative;
}

.sl-filter-btn {
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.sl-filter-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.sl-filter-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04);
  padding: 6px;
  min-width: 160px;
  z-index: 100;
  display: none;
}

.sl-filter-dropdown-menu.open {
  display: flex;
  flex-direction: column;
}

.sl-filter-option {
  padding: 8px 12px;
  font-size: 0.84rem;
  color: #334155;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sl-filter-option:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.sl-filter-option.active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}

/* Sources List */
.sl-sources-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-right: 0.4rem;
}

/* Custom Scrollbar for Sources List */
.sl-sources-list::-webkit-scrollbar,
.sl-sidebar::-webkit-scrollbar {
  width: 6px;
}
.sl-sources-list::-webkit-scrollbar-track,
.sl-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sl-sources-list::-webkit-scrollbar-thumb,
.sl-sidebar::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 9999px;
}

/* Source Card Item */
.sl-card {
  display: flex;
  align-items: center;
  padding: 0.85rem 1.15rem;
  border-radius: 12px;
  border: 1px solid #f1f5f9;
  background: #ffffff;
  transition: all 0.15s ease;
}

.sl-card:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.sl-card-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: 1.1rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.sl-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.sl-card-meta-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sl-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.sl-card-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  line-height: 1.3;
}

.sl-card-tag.channel {
  background: #dbeafe;
  color: #1d4ed8;
}

.sl-card-tag.group {
  background: #dcfce7;
  color: #15803d;
}

.sl-card-tag.web {
  background: #e0e7ff;
  color: #4338ca;
}

.sl-card-tag.profile {
  background: #fce7f3;
  color: #be185d;
}

.sl-card-members {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.sl-card-desc {
  font-size: 0.8rem;
  color: #64748b;
  margin: 3px 0 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sl-card-controls {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-left: 1.25rem;
  flex-shrink: 0;
}

.sl-card-updated {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  min-width: 85px;
}

.sl-updated-label {
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 500;
}

.sl-updated-val {
  font-size: 0.78rem;
  color: #0f172a;
  font-weight: 600;
  margin-top: 1px;
}

/* iOS Style Toggle Switch */
.sl-toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: #cbd5e1;
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.sl-toggle.active {
  background: #2563eb;
}

.sl-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: left 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sl-toggle.active .sl-toggle-knob {
  left: 22px;
}

.sl-card-more-btn {
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.sl-card-more-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* Dark Theme Adaptations */
[data-theme="dark"] .sl-modal-container,
:root:not([data-theme="light"]) .sl-modal-container {
  background: #11141d;
  color: #f8fafc;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .sl-header,
:root:not([data-theme="light"]) .sl-header {
  background: #11141d;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .sl-header-icon-box,
:root:not([data-theme="light"]) .sl-header-icon-box {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

[data-theme="dark"] .sl-header-title,
:root:not([data-theme="light"]) .sl-header-title {
  color: #f8fafc;
}

[data-theme="dark"] .sl-body,
:root:not([data-theme="light"]) .sl-body {
  background: #11141d;
}

[data-theme="dark"] .sl-sidebar,
:root:not([data-theme="light"]) .sl-sidebar {
  background: #11141d;
  border-right-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .sl-platform-item:hover,
:root:not([data-theme="light"]) .sl-platform-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

[data-theme="dark"] .sl-platform-item.active,
:root:not([data-theme="light"]) .sl-platform-item.active {
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .sl-platform-name,
:root:not([data-theme="light"]) .sl-platform-name {
  color: #f8fafc;
}

[data-theme="dark"] .sl-platform-badge,
:root:not([data-theme="light"]) .sl-platform-badge {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
}

[data-theme="dark"] .sl-content,
:root:not([data-theme="light"]) .sl-content {
  background: #11141d;
}

[data-theme="dark"] .sl-content-title,
:root:not([data-theme="light"]) .sl-content-title {
  color: #f8fafc;
}

[data-theme="dark"] .sl-search-input,
:root:not([data-theme="light"]) .sl-search-input {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
}

[data-theme="dark"] .sl-filter-btn,
:root:not([data-theme="light"]) .sl-filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

[data-theme="dark"] .sl-filter-dropdown-menu,
:root:not([data-theme="light"]) .sl-filter-dropdown-menu {
  background: #181c28;
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .sl-filter-option,
:root:not([data-theme="light"]) .sl-filter-option {
  color: #cbd5e1;
}

[data-theme="dark"] .sl-filter-option:hover,
:root:not([data-theme="light"]) .sl-filter-option:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

[data-theme="dark"] .sl-card,
:root:not([data-theme="light"]) .sl-card {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .sl-card:hover,
:root:not([data-theme="light"]) .sl-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .sl-card-title,
:root:not([data-theme="light"]) .sl-card-title {
  color: #f8fafc;
}

[data-theme="dark"] .sl-updated-val,
:root:not([data-theme="light"]) .sl-updated-val {
  color: #f8fafc;
}



/* ── Run card: live preview of the run's tab, on a small iMac (workflowRunCard.js) ── */
.wf-run { container-type: inline-size; }
.wfp-body { display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); gap: 32px; align-items: start; }
.wfp-steps { min-width: 0; }
@container (max-width: 720px) {
  .wfp-body { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .wfp { order: -1; }
}
.wfp-folded {
  width: 100%; display: flex; align-items: center; gap: 10px; margin: 0 0 2px; padding: 8px 10px;
  background: #f8fafc; border: none; border-radius: 10px; cursor: pointer; text-align: left;
  font: inherit; font-size: 0.88rem; color: #64748b; line-height: 1.4; font-variant-numeric: tabular-nums;
  transition: background-color 120ms ease;
}
.wfp-folded span { flex: 1; }
.wfp-folded:hover { background: #f1f5f9; }
.wfp-folded:active { background: #e9eef4; }

.wfp { min-width: 0; padding-top: 4px; }
.wfp-mac {
  width: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; align-items: center;
  cursor: pointer; outline: none; border-radius: 16px; transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1);
}
.wfp-mac:active { transform: scale(0.99); }
.wfp-mac:focus-visible .wfp-panel { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2563eb; }
/* Clicking anywhere on the iMac opens the run's tab; the chip says so on hover */
.wfp-open {
  position: absolute; top: 46px; right: 22px; z-index: 2; display: inline-flex; align-items: center; gap: 4px;
  height: 26px; padding: 0 10px; border-radius: 999px; background: rgba(15, 23, 42, 0.82); color: #fff;
  font-size: 0.75rem; font-weight: 600; line-height: 1; pointer-events: none;
  opacity: 0; transform: translateY(-2px); transition: opacity 150ms ease-out, transform 150ms ease-out;
}
.wfp-mac:hover .wfp-open, .wfp-mac:focus-visible .wfp-open { opacity: 1; transform: none; }
@media (hover: none) { .wfp-open { display: none; } }
.wfp-panel {
  width: 100%; border-radius: 14px; overflow: hidden; background: linear-gradient(#e5e7eb, #d8dbe0);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 0 0 1px rgba(15, 23, 42, 0.06), 0 16px 30px -18px rgba(15, 23, 42, 0.32);
}
.wfp-glass { position: relative; background: #f9f9fa; padding: 12px 12px 10px; border-bottom: 1px solid #d3d7dc; }
.wfp-cam { position: absolute; top: 4px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: #30343a; }
.wfp-screen { border-radius: 3px; overflow: hidden; background: #2f2f2f; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12); }
.wfp-chin { height: 38px; }
.wfp-neck { width: 26%; height: 46px; background: linear-gradient(#c7cbd1 0, #dcdfe4 10px, #d5d9de 100%); clip-path: polygon(3% 0, 97% 0, 100% 100%, 0 100%); }
.wfp-foot { width: 30%; height: 5px; border-radius: 0 0 4px 4px; background: linear-gradient(#d2d6db, #bcc1c7); }
.wfp-bar { height: 24px; background: #eef0f3; border-bottom: 1px solid #dfe3e8; display: flex; align-items: center; gap: 8px; padding: 0 8px; }
.wfp-lights { display: flex; gap: 4px; flex-shrink: 0; }
.wfp-lights i { width: 7px; height: 7px; border-radius: 50%; display: block; background: #ff5f57; }
.wfp-lights i:nth-child(2) { background: #febc2e; }
.wfp-lights i:nth-child(3) { background: #28c840; }
.wfp-addr {
  flex: 1; min-width: 0; height: 17px; border-radius: 5px; background: #fff; border: 1px solid #e2e8f0;
  display: flex; align-items: center; gap: 4px; padding: 0 6px; overflow: hidden; white-space: nowrap;
  font-size: 10.5px; line-height: 1; color: #64748b;
}
.wfp-addr span { overflow: hidden; text-overflow: ellipsis; }
.wfp-addr b { color: #0f172a; font-weight: 500; }
.wfp-tab { position: relative; width: 100%; background: #f8fafc; overflow: hidden; }
.wfp-tab img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wfp-ring {
  border-radius: 3px; pointer-events: none;
  box-shadow: 0 0 0 1.5px #2563eb, 0 0 0 4px rgba(37, 99, 235, 0.28);
  transition: left 200ms cubic-bezier(0.23, 1, 0.32, 1), top 200ms cubic-bezier(0.23, 1, 0.32, 1), width 200ms cubic-bezier(0.23, 1, 0.32, 1), height 200ms cubic-bezier(0.23, 1, 0.32, 1);
}
.wfp-state {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 16px; text-align: center; background: #f8fafc;
}
/* A message instead of a frame: at least 16:9, taller when a narrow card needs room for it */
.wfp-tab.is-state { aspect-ratio: auto !important; }
.wfp-tab.is-state .wfp-state { position: relative; inset: auto; aspect-ratio: 16 / 9; }
.wfp-state-icon { width: 36px; height: 36px; border-radius: 50%; background: #fff; border: 1px solid #e2e8f0; display: grid; place-items: center; margin-bottom: 6px; }
.wfp-state-title { font-size: 0.88rem; font-weight: 600; color: #0f172a; line-height: 1.35; }
.wfp-state-text { font-size: 0.8rem; color: #64748b; line-height: 1.4; }
.wfp-btn {
  margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  background: #2563eb; color: #fff; border: none; border-radius: 8px; cursor: pointer;
  font: inherit; font-size: 0.82rem; font-weight: 600; transition: transform 120ms ease-out, background-color 120ms ease;
}
.wfp-btn:hover { background: #1d4ed8; }
.wfp-btn:active { transform: scale(0.97); }
.wfp-under {
  max-width: 560px; margin: 14px auto 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 0.82rem; line-height: 1.4; color: #64748b;
}
.wfp-live { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wfp-live b { color: #15803d; font-weight: 600; }
.wfp-dot { width: 6px; height: 6px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.14); }
.wfp-dot.is-off { background: #94a3b8; box-shadow: none; }
.wfp-sep { width: 1px; height: 14px; background: #e2e8f0; }
.wfp-now { font-weight: 600; color: #0f172a; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.wfp-val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wfp-count { margin-left: auto; font-size: 0.78rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .wfp-ring, .wfp-mac, .wfp-open { transition: none; } }


/* ── Input bar: the round button as "stop" (an answer streaming, a workflow running) ── */
.starman-pill-mic-btn.is-stop { background: #0f172a; box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22); }
.starman-pill-mic-btn.is-stop:hover { background: #1e293b; }
.starman-pill-mic-btn.is-stop svg { width: 18px; height: 18px; }
.starman-stopped-note {
  display: flex; width: fit-content; align-items: center; gap: 6px; margin-top: 10px;
  font-size: 0.82rem; line-height: 1.4; color: #64748b;
}
.starman-stopped-note svg { width: 12px; height: 12px; color: #94a3b8; flex-shrink: 0; }
.starman-stopped-row { margin: -16px 0 28px 64px; }


/* ── Agent panel: the right column of the Starman view (js/components/agentPanel.js) ── */
.agent-panel {
  --ap-ink: #0f172a; --ap-muted: #64748b; --ap-faint: #94a3b8; --ap-line: #e8ebf0;
  --ap-fill: #f1f5f9; --ap-bg: #ffffff; --ap-accent: #2563eb; --ap-soft: #334155;
  --ap-user-bg: #dbeafe; --ap-user-ink: #1e40af; --ap-user-empty: #f1f5f9; /* solid: these sit over Starman's avatar */
  position: relative; flex: none; width: 400px; max-width: 100vw; height: 100vh; display: flex; flex-direction: column;
  background: var(--ap-bg); border-left: 1px solid var(--ap-line); color: var(--ap-ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; z-index: 101;
}
.agent-panel[hidden] { display: none; }
[data-theme="dark"] .agent-panel {
  --ap-ink: #f1f5f9; --ap-muted: #94a3b8; --ap-faint: #64748b; --ap-line: rgba(255, 255, 255, 0.08);
  --ap-fill: rgba(255, 255, 255, 0.06); --ap-bg: #11141d; --ap-accent: #7aa2ff; --ap-soft: #cbd5e1;
  --ap-user-bg: #242e46; --ap-user-ink: #c7d7ff; --ap-user-empty: #1f2430;
}
/* Narrow windows: it floats over the chat instead of taking room from it */
@media (max-width: 1099px) {
  .agent-panel { position: fixed; top: 0; right: 0; bottom: 0; height: auto; z-index: 1001; box-shadow: -16px 0 40px -12px rgba(15, 23, 42, 0.22); }
}
.agent-panel-close {
  position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; padding: 0;
  display: grid; place-items: center; background: none; border: none; border-radius: 8px;
  color: var(--ap-muted); cursor: pointer; transition: background-color 120ms ease, color 120ms ease;
}
.agent-panel-close:hover { background: var(--ap-fill); color: var(--ap-ink); }
.agent-panel-close:active { transform: scale(0.96); }
.agent-panel-close:focus-visible { outline: 2px solid var(--ap-accent); outline-offset: -2px; }
.agent-panel-close svg { width: 18px; height: 18px; }
/* Brings the panel back once it's closed (or wasn't shown, on a narrow window): where its × was */
.agent-panel-reopen {
  position: fixed; top: 16px; right: 16px; z-index: 1000; width: 36px; height: 36px; padding: 0;
  display: grid; place-items: center; border: 1px solid #e8ebf0; border-radius: 10px;
  background: rgba(255, 255, 255, 0.92); color: #64748b; cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.08);
  transition: color 150ms ease-out, background-color 150ms ease-out, transform 150ms ease-out;
}
.agent-panel-reopen[hidden] { display: none; }
.agent-panel-reopen:hover { color: #0f172a; background: #ffffff; }
.agent-panel-reopen:active { transform: scale(0.96); }
.agent-panel-reopen:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.agent-panel-reopen svg { width: 18px; height: 18px; }
[data-theme="dark"] .agent-panel-reopen { background: rgba(17, 20, 29, 0.92); border-color: rgba(255, 255, 255, 0.08); color: #94a3b8; }
[data-theme="dark"] .agent-panel-reopen:hover { background: #11141d; color: #f1f5f9; }
.agent-panel-head { display: flex; flex-direction: column; align-items: center; padding: 56px 24px 24px; }
.agent-panel-avatars { position: relative; }
.agent-panel-avatar {
  width: 88px; height: 88px; border-radius: 50%; overflow: hidden; background: #fff;
  box-shadow: 0 0 0 3px var(--ap-bg), 0 0 0 4px var(--ap-line), 0 8px 24px -8px rgba(15, 23, 42, 0.25);
}
.agent-panel-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* The user, on Starman's lower right: the panel-coloured ring cuts it out of the avatar behind */
.agent-panel-user {
  position: absolute; right: -6px; bottom: -4px; width: 36px; height: 36px;
  display: grid; place-items: center; overflow: hidden; border-radius: 50%;
  background: var(--ap-user-bg); color: var(--ap-user-ink); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
  box-shadow: 0 0 0 3px var(--ap-bg), 0 2px 8px -2px rgba(15, 23, 42, 0.3);
}
.agent-panel-user img { width: 100%; height: 100%; object-fit: cover; display: block; }
.agent-panel-user.is-empty { background: var(--ap-user-empty); color: var(--ap-muted); }
.agent-panel-user.is-empty svg { width: 16px; height: 16px; }
.agent-panel-name { margin-top: 18px; font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
/* In place of a status line: the user's name · the university, each cut short if it must be */
.agent-panel-who {
  margin-top: 4px; max-width: 100%; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 0.8125rem; line-height: 1.4; color: var(--ap-muted);
}
.agent-panel-username { flex: 0 1 auto; min-width: 3em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--ap-soft); }
.agent-panel-login {
  flex: none; padding: 0; background: none; border: none; border-radius: 4px;
  font: inherit; font-weight: 500; color: var(--ap-accent); cursor: pointer;
}
.agent-panel-login:hover { text-decoration: underline; text-underline-offset: 2px; }
.agent-panel-login:focus-visible { outline: 2px solid var(--ap-accent); outline-offset: 2px; }
.agent-panel-sep { flex: none; width: 3px; height: 3px; border-radius: 50%; background: var(--ap-faint); }
.agent-panel-universe { flex: 0 1 auto; min-width: 5em; display: inline-flex; align-items: center; gap: 6px; }
.agent-panel-logo {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--ap-fill) center / cover no-repeat; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}
.agent-panel-universe-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.agent-panel-tabs {
  position: relative; margin: 0 20px; padding: 4px; height: 44px; flex: none;
  display: grid; grid-template-columns: repeat(4, 1fr); background: var(--ap-fill); border-radius: 12px;
}
.agent-panel-indicator {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 4);
  border-radius: 9px; background: var(--ap-bg);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(15, 23, 42, 0.04);
  transition: transform 220ms cubic-bezier(0.23, 1, 0.32, 1);
}
.agent-panel-tab {
  position: relative; z-index: 1; display: grid; place-items: center; padding: 0;
  background: none; border: none; border-radius: 9px; color: var(--ap-muted); cursor: pointer;
  transition: color 150ms ease;
}
.agent-panel-tab svg { width: 17px; height: 17px; }
.agent-panel-tab:hover, .agent-panel-tab[aria-selected="true"] { color: var(--ap-ink); }
.agent-panel-tab:focus-visible { outline: 2px solid var(--ap-accent); outline-offset: -2px; }

.agent-panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 20px; }
.agent-panel-section { font-size: 0.8125rem; font-weight: 600; color: var(--ap-ink); margin-bottom: 12px; }
.agent-panel-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 16px; }
.agent-panel-empty-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--ap-fill); color: var(--ap-muted); display: grid; place-items: center; margin-bottom: 12px; }
.agent-panel-empty-icon svg { width: 18px; height: 18px; }
.agent-panel-empty-title { font-size: 0.875rem; font-weight: 600; color: var(--ap-ink); }
.agent-panel-empty-hint { margin-top: 4px; max-width: 240px; font-size: 0.8125rem; line-height: 1.45; color: var(--ap-muted); text-wrap: pretty; }

@media (prefers-reduced-motion: reduce) { .agent-panel-indicator { transition: none; } }

/* ── Run card: what a read skill read (workflowRunCard.js readsPanel) ── */
.wfr { margin-top: 12px; padding-top: 12px; border-top: 1px solid #f1f5f9; }
.wfr-status { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: #64748b; }
.wfr-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.wfr-title { font-weight: 600; font-size: 0.95rem; color: #0f172a; }
.wfr-count {
  font-size: 0.75rem; font-weight: 600; color: #475569; background: #f1f5f9; border-radius: 999px;
  padding: 1px 8px; font-variant-numeric: tabular-nums;
}
.wfr-list { list-style: none; margin: 0; padding: 0; }
.wfr-item { padding: 10px 0; border-top: 1px solid #f1f5f9; min-width: 0; }
.wfr-item:first-child { border-top: none; padding-top: 4px; }
.wfr-primary { font-size: 0.92rem; font-weight: 500; color: #1e293b; line-height: 1.4; overflow-wrap: anywhere; }
.wfr-meta { display: flex; flex-wrap: wrap; gap: 2px 0; margin-top: 2px; font-size: 0.78rem; color: #64748b; }
.wfr-meta > span + span::before { content: "·"; margin: 0 6px; color: #cbd5e1; }
.wfr-label { color: #94a3b8; }
/* A list's one-line summary (questions: right / wrong, or obtained of max) */
.wfr-sum { margin: -2px 0 6px; font-size: 0.82rem; color: #475569; font-variant-numeric: tabular-nums; }
/* A picture read off the portal (the OMR sheet): framed, larger on a click */
.wfr-figure { margin: 10px 0 0; }
.wfr-figure figcaption { margin-top: 6px; font-size: 0.75rem; color: #64748b; }
.wfr-picture {
  display: block; padding: 0; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; overflow: hidden;
  cursor: zoom-in; max-width: 100%; transition: border-color 150ms ease, transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.wfr-picture img { display: block; max-width: 100%; max-height: 360px; object-fit: contain; }
.wfr-picture.is-thumb { display: inline-block; margin-top: 6px; }
.wfr-picture.is-thumb img { max-height: 72px; }
@media (hover: hover) and (pointer: fine) { .wfr-picture:hover { border-color: #cbd5e1; } }
.wfr-picture:active { transform: scale(0.99); }
.wfr-picture:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.wfr-lightbox {
  position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 32px;
  background: rgba(15, 23, 42, 0.72); cursor: zoom-out; animation: wfr-lightbox-in 180ms ease-out;
}
.wfr-lightbox img {
  max-width: min(100%, 1100px); max-height: calc(100vh - 64px); object-fit: contain; border-radius: 10px; background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); animation: wfr-lightbox-img 220ms cubic-bezier(0.23, 1, 0.32, 1);
}
.wfr-lightbox-close {
  position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, 0.9); color: #0f172a; font-size: 20px; line-height: 1; cursor: pointer;
}
.wfr-lightbox-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@keyframes wfr-lightbox-in { from { opacity: 0; } }
@keyframes wfr-lightbox-img { from { opacity: 0; transform: scale(0.97); } }
@media (prefers-reduced-motion: reduce) { .wfr-lightbox, .wfr-lightbox img { animation: wfr-lightbox-in 120ms ease-out; } }
/* The records asked about first; the others as chips that show one of them instead */
.wfr-others { margin-top: 10px; }
.wfr-others-title { font-size: 0.78rem; color: #94a3b8; margin-bottom: 6px; }
.wfr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wfr-chip {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 20px; padding: 4px 12px; font: inherit; font-size: 0.82rem;
  color: #475569; cursor: pointer; font-variant-numeric: tabular-nums;
  transition: background-color 150ms ease, border-color 150ms ease, transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
@media (hover: hover) and (pointer: fine) { .wfr-chip:hover { background: #f8fafc; border-color: #cbd5e1; } }
.wfr-chip:active { transform: scale(0.97); }
.wfr-chip:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
/* Single values (a CGPA): label over value, side by side */
.wfr-values { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 2px 0 0; }
.wfr-value { padding: 8px 12px; background: #f8fafc; border-radius: 10px; min-width: 0; }
.wfr-value.is-wide { grid-column: 1 / -1; }
.wfr-value dt { font-size: 0.75rem; color: #64748b; line-height: 1.3; }
.wfr-value dd { margin: 2px 0 0; font-size: 1.05rem; font-weight: 600; color: #0f172a; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.wfr-text {
  margin-top: 4px; font-size: 0.85rem; color: #475569; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.wfr-link {
  display: inline-flex; align-items: center; gap: 2px; margin-top: 4px; font-size: 0.78rem; font-weight: 600;
  color: #2563eb; text-decoration: none;
}
.wfr-link:hover { text-decoration: underline; }
.wfr-empty { font-size: 0.85rem; color: #64748b; padding: 4px 0; }
.wfr-note { margin-top: 6px; font-size: 0.78rem; color: #94a3b8; }
.wfr-more {
  background: none; border: none; padding: 6px 0 0; font: inherit; font-size: 0.82rem; font-weight: 600;
  color: #2563eb; cursor: pointer; transition: transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.wfr-status .wfr-more { padding: 0; margin-left: 4px; }
.wfr-more:active { transform: scale(0.97); }
.wfr-more:focus-visible, .wfr-link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; border-radius: 4px; }
/* An answer from a kept read: Refresh reads it again live, in place of the timer */
.wfc-refresh {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; height: 30px; padding: 0 12px;
  border: 1px solid #e2e8f0; border-radius: 999px; background: #fff; color: #334155;
  font: inherit; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  transition: transform 160ms cubic-bezier(0.23, 1, 0.32, 1), background-color 160ms ease, border-color 160ms ease;
}
.wfc-refresh:active:not(:disabled) { transform: scale(0.97); }
.wfc-refresh:disabled { cursor: default; color: #64748b; }
.wfc-refresh:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .wfc-refresh:hover:not(:disabled) { background: #f8fafc; border-color: #cbd5e1; } }
/* The records ease in once, when they arrive */
.wfr.is-new .wfr-item, .wfr.is-new .wfr-value { animation: wfr-in 220ms cubic-bezier(0.23, 1, 0.32, 1) both; animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes wfr-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) {
  .wfr.is-new .wfr-item, .wfr.is-new .wfr-value { animation-name: wfr-fade; animation-delay: 0ms; }
  @keyframes wfr-fade { from { opacity: 0; } }
}

/* ── Run card: files the run downloaded (workflowRunCard.js filesPanel, runFiles.js) ── */
.wff-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #f1f5f9; }
.wff-item { width: min(100%, 300px); }
.wff {
  display: flex; flex-direction: column; width: 100%; padding: 0; border: 1px solid #e2e8f0; border-radius: 12px;
  background: #fff; overflow: hidden; text-align: left; font: inherit; color: inherit; cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
@media (hover: hover) and (pointer: fine) {
  .wff:hover { border-color: #cbd5e1; box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07); }
  .wff:hover .wff-action { background: #fff; color: #1d4ed8; }
}
.wff:active { transform: scale(0.98); }
.wff:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
/* The top of the first page, fading out at the bottom */
.wff-preview { position: relative; display: block; height: 168px; background: #f8fafc; border-bottom: 1px solid #f1f5f9; overflow: hidden; }
.wff-preview img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.wff-preview img.is-new { animation: wff-in 260ms cubic-bezier(0.23, 1, 0.32, 1); }
.wff-preview::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 36px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.92));
}
.wff-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 100%; }
.wff-placeholder.is-loading {
  background: linear-gradient(90deg, #f1f5f9 25%, #f8fafc 50%, #f1f5f9 75%); background-size: 200% 100%;
  animation: wff-shimmer 1.2s linear infinite;
}
.wff-kind { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; color: #64748b; }
.wff-action {
  position: absolute; right: 10px; bottom: 10px; z-index: 1; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border: 1px solid rgba(226, 232, 240, 0.9); border-radius: 999px; background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08); font-size: 0.75rem; font-weight: 600; color: #2563eb;
  transition: color 150ms ease, background-color 150ms ease;
}
.wff-action.is-done { color: #16a34a; }
.wff-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.wff-icon { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #eff6ff; }
.wff-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wff-name { font-size: 0.88rem; font-weight: 600; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wff-meta { font-size: 0.75rem; color: #64748b; font-variant-numeric: tabular-nums; }
.wff-note { margin-top: 6px; font-size: 0.78rem; line-height: 1.4; color: #b45309; }
@keyframes wff-in { from { opacity: 0; } }
@keyframes wff-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .wff-placeholder.is-loading { animation: none; }
  .wff:active { transform: none; }
}

/* ── Run card: what next (workflowRunCard.js nextStepsPanel), like the chips under an answer ── */
/* A read run answered in words: where it was read and the rest of what it read, under the answer */
.wfa { margin-top: 12px; }
/* A read that went to the portal, answered in words: its card, this line, then the answer (renderReadAnswer) */
.wfa-divider { height: 0; margin: 18px 0 16px; border: 0; border-top: 1px solid #e2e8f0; }
.wfa-answer > :first-child { margin-top: 0; }
.wfa-answer > :last-child { margin-bottom: 0; }
.wfa-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.82rem; line-height: 1.5; color: #64748b; }
.wfa-src { display: inline-flex; align-items: center; gap: 6px; }
.wfa-src svg { flex-shrink: 0; }
.wfa-warn { color: #92400e; }
.wfa-dot { color: #cbd5e1; }
.wfa-link {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 0; border: 0; background: none;
  font: inherit; font-size: 0.82rem; font-weight: 600; color: #2563eb; cursor: pointer;
  transition: transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.wfa-link:active { transform: scale(0.97); }
.wfa-link:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; border-radius: 4px; }
@media (hover: hover) and (pointer: fine) { .wfa-link:hover { text-decoration: underline; text-underline-offset: 2px; } }
.wfa-more { padding: 6px 4px; }
.wfa-full { margin-top: 10px; }
/* A just-arrived answer: its words one after another, then its footer (workflowRunCard typeInAnswer) */
.wfa-word { animation: wfa-word-in 200ms cubic-bezier(0.23, 1, 0.32, 1) both; }
@keyframes wfa-word-in { from { opacity: 0; filter: blur(2px); } to { opacity: 1; filter: none; } }
.wfa-after { animation: wfa-after-in 220ms cubic-bezier(0.23, 1, 0.32, 1) both; }
@keyframes wfa-after-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wfa-word, .wfa-after { animation: none; } }
.wfa-pending { margin-top: 0; display: flex; align-items: center; gap: 10px; font-size: 0.88rem; color: #64748b; }
/* The answer on its way: dots rising one after another, a light sweep across the words. Phases follow
   the clock (--wfa-phase), so a redrawn card carries on mid-motion */
.wfa-dots { display: inline-flex; align-items: center; gap: 4px; height: 14px; }
.wfa-dots i {
  width: 6px; height: 6px; border-radius: 50%; background: #94a3b8;
  animation: wfa-dot 1.2s cubic-bezier(0.45, 0, 0.55, 1) infinite;
  animation-delay: var(--wfa-phase, 0ms);
}
.wfa-dots i:nth-child(2) { animation-delay: calc(var(--wfa-phase, 0ms) + 150ms); }
.wfa-dots i:nth-child(3) { animation-delay: calc(var(--wfa-phase, 0ms) + 300ms); }
@keyframes wfa-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-3px); opacity: 1; }
}
.wfa-shimmer {
  background: linear-gradient(90deg, #64748b 0%, #64748b 35%, #cbd5e1 50%, #64748b 65%, #64748b 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: wfa-shimmer 1.8s linear infinite; animation-delay: var(--wfa-phase, 0ms);
}
@keyframes wfa-shimmer { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@media (prefers-reduced-motion: reduce) {
  .wfa-dots i { animation: none; opacity: 0.7; }
  .wfa-shimmer { animation: none; background: none; color: #64748b; }
}
/* Every run-card spinner turns, also outside a card (its own <style> only comes with a whole card) */
@keyframes wf-spin { to { transform: rotate(360deg); } }
.wf-spin { animation: wf-spin 0.9s linear infinite; }
.wfa-next { margin-top: 14px; }
.wfn { display: flex; align-items: flex-start; gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid #f1f5f9; }
.wfn-icon { flex-shrink: 0; margin-top: 2px; display: inline-flex; }
.wfn-main { flex: 1; min-width: 0; }
.wfn-title { font-size: 0.85rem; font-weight: 600; color: #0f172a; margin-bottom: 10px; }
.wfn-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wfn-chip {
  display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid #e2e8f0; border-radius: 20px;
  padding: 6px 14px; font: inherit; font-size: 0.85rem; color: #475569; cursor: pointer; text-align: left;
  transition: background-color 150ms ease, border-color 150ms ease, transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
@media (hover: hover) and (pointer: fine) { .wfn-chip:hover { background: #f8fafc; border-color: #cbd5e1; } }
.wfn-chip:active { transform: scale(0.97); }
.wfn-chip:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

/* ── Starman's reaction on the student's bubble (js/reactions.js): one emoji, like a friend's tap-back,
   hanging off the bubble's bottom edge near its right end (the tail joins at the corner itself) ── */
.starman-reaction {
  position: absolute; bottom: -16px; right: 16px; z-index: 3;
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.12);
  cursor: default; user-select: none;
}
.starman-reaction img { display: block; width: 24px; height: 24px; }
/* It pops in once, out of the bubble's edge, when it arrives; the chat drawn again shows it still */
.starman-reaction.is-new {
  transform-origin: 50% 0%;
  transition: transform 280ms cubic-bezier(0.34, 1.45, 0.64, 1), opacity 140ms ease-out;
}
@starting-style {
  .starman-reaction.is-new { opacity: 0; transform: scale(0.6) rotate(-10deg); }
}
/* "Just now" under the bubble makes room for it (eased when it arrives, still when the chat is drawn again) */
.starman-user-meta { margin-top: 6px; transition: margin-top 200ms cubic-bezier(0.23, 1, 0.32, 1); }
.starman-user-row-wrapper:has(.starman-reaction) .starman-user-meta { margin-top: 24px; }
/* Copy and retry, left of "Just now": shown while the question is hovered (always, on touch) */
.starman-query-actions {
  display: inline-flex; align-items: center; gap: 2px; margin-right: 6px;
  opacity: 0; transition: opacity 150ms ease-out;
}
.starman-user-row-wrapper:hover .starman-query-actions,
.starman-query-actions:focus-within { opacity: 1; }
@media (hover: none) { .starman-query-actions { opacity: 1; } }
.starman-query-action {
  display: grid; place-items: center; width: 26px; height: 26px; padding: 0;
  border: none; border-radius: 8px; background: transparent; color: #94a3b8; cursor: pointer;
  transition: color 150ms ease-out, background-color 150ms ease-out, transform 150ms ease-out;
}
.starman-query-action svg { width: 14px; height: 14px; }
.starman-query-action:hover { color: #334155; background: rgba(15, 23, 42, 0.06); }
.starman-query-action:active { transform: scale(0.97); }
.starman-query-action:focus-visible { outline: 2px solid #3b82f6; outline-offset: 1px; }
.starman-query-action.is-copied { color: #10b981; }
.is-answering .starman-query-retry { opacity: 0.35; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  .starman-reaction.is-new { transition: opacity 150ms ease-out; }
  @starting-style { .starman-reaction.is-new { transform: none; } }
  .starman-user-meta { transition: none; }
}

/* ── A run asking in the chat (workflowRunCard.js questionPanel): Starman's question, the page's
   options as chips, the student's answers as their own bubbles; one question at a time ── */
.wfq { margin-top: 14px; padding-top: 14px; border-top: 1px solid #f1f5f9; display: flex; flex-direction: column; gap: 12px; }
.wfq-turn { display: flex; flex-direction: column; gap: 8px; }
.wfq-ask { align-self: flex-start; max-width: 92%; font-size: 0.95rem; line-height: 1.5; color: #334155; }
.wfq-turn.is-now .wfq-ask { color: #0f172a; font-weight: 600; }
.wfq-reply {
  align-self: flex-end; max-width: 80%; padding: 7px 14px; border-radius: 18px 18px 4px 18px;
  background: #bbf7d0; color: #14532d; font-size: 0.92rem; font-weight: 500; line-height: 1.45; word-break: break-word;
}
.wfq-reply.is-pending { opacity: 0.6; }
.wfq-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wfq-chip {
  display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid #e2e8f0; border-radius: 20px;
  padding: 7px 14px; font: inherit; font-size: 0.88rem; color: #1e293b; cursor: pointer; text-align: left;
  transition: background-color 150ms ease, border-color 150ms ease, transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
@media (hover: hover) and (pointer: fine) { .wfq-chip:hover { background: #f8fafc; border-color: #cbd5e1; } }
.wfq-chip:active { transform: scale(0.97); }
.wfq-chip:focus-visible, .wfq-pick:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.wfq-chip.is-quiet { color: #64748b; }
.wfq-chip.is-usual { color: #15803d; border-color: #bbf7d0; background: #f0fdf4; }
.wfq-chip.is-fix { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }
.wfq-chip.is-primary { color: #fff; border-color: #2563eb; background: #2563eb; font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .wfq-chip.is-primary:hover { background: #1d4ed8; border-color: #1d4ed8; } }
.wfq-pick {
  border: 1px solid #e2e8f0; border-radius: 20px; padding: 6px 12px; font: inherit; font-size: 0.88rem;
  color: #1e293b; background: #fff;
}
.wfq-masked { display: flex; gap: 8px; width: 100%; }
.wfq-masked input {
  flex: 1; min-width: 0; border: 1px solid #cbd5e1; border-radius: 20px; padding: 7px 14px; font: inherit; font-size: 0.9rem;
}
.wfq-hint { font-size: 0.8rem; color: #64748b; }
.wfq-note { font-size: 0.84rem; color: #64748b; }
.wfq-note.is-error { color: #b91c1c; }
/* A new question comes in once (the card redraws on every event: only a new one fades in) */
.wfq-turn.is-new { animation: wfq-in 180ms cubic-bezier(0.23, 1, 0.32, 1); }
@keyframes wfq-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .wfq-turn.is-new { animation: wfq-fade 120ms ease-out; } }
@keyframes wfq-fade { from { opacity: 0; } }
/* What a run took from the student's words instead of asking */
.wfq-understood { color: #475569; font-size: 0.88rem; }
.wfq-understood span { color: #0f172a; font-weight: 500; }
/* A question several options may answer: the picked ones, plainly picked */
.wfq-chip.is-on { color: #fff; border-color: #2563eb; background: #2563eb; font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .wfq-chip.is-on:hover { background: #1d4ed8; border-color: #1d4ed8; } }
.wfq-chip:disabled { opacity: 0.5; cursor: default; transform: none; }

/* The question's recommendation and its buttons, each on a line of its own under the options */
.wfq-turn.is-now { gap: 10px; }
.wfq-turn.is-now .wfq-ask { font-size: 1rem; }
.wfq-section { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; padding-top: 12px; border-top: 1px solid #eef2f7; }
.wfq-section-label { font-size: 0.8rem; color: #64748b; }
.wfq-actions { flex-direction: row; align-items: center; gap: 10px; }
.wfq-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 20px;
  border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; color: #0f172a;
  font: inherit; font-size: 0.92rem; font-weight: 600; cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 120ms cubic-bezier(0.23, 1, 0.32, 1);
}
.wfq-btn.is-primary { min-width: 128px; border-color: #2563eb; background: #2563eb; color: #fff; }
@media (hover: hover) and (pointer: fine) {
  .wfq-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
  .wfq-btn.is-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
}
.wfq-btn:active { transform: scale(0.97); }
.wfq-btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.wfq-btn:disabled { opacity: 0.45; cursor: default; transform: none; }
@media (prefers-reduced-motion: reduce) { .wfq-btn, .wfq-chip { transition: background-color 150ms ease, border-color 150ms ease; } }
