/* Private character switcher. All styles stay inside the opt-in pilot. */
.working-character-bar {
  --wc-surface: #17161c;
  --wc-border: rgba(255, 255, 255, .09);
  --wc-muted: #96919f;
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 6px 0;
  min-width: 0;
  max-width: 100%;
  color: #f4f1f7;
  font-size: 13px;
}
body:has(.working-character-bar) #topNavbar { height: auto; min-height: 56px; flex-wrap: wrap; }
body.vix-app-shell-v2:has(.working-character-bar) { --vix-topbar-height: var(--vix-working-topbar-height, 56px); }
.working-character-bar button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.working-character-bar [hidden], .output-item[hidden] { display: none !important; }

.wc-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 208px;
  max-width: 100%;
  min-height: 46px;
  padding: 5px 12px 5px 6px;
  border: 1px solid var(--wc-border);
  border-radius: 14px;
  background: linear-gradient(145deg, #24212a, #17161c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 2px 8px #0002;
  color: #f4f1f7;
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}
.wc-trigger:hover { border-color: rgba(216, 164, 255, .27); background: #25212d; }
.wc-trigger[aria-expanded=true] { border-color: rgba(216, 164, 255, .4); box-shadow: 0 0 0 3px #bc7bec0b; }
.wc-trigger-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; letter-spacing: .01em; }
.wc-chevron { flex: 0 0 16px; color: #aaa2b3; transition: transform 180ms ease; }
.wc-trigger[aria-expanded=true] > .wc-chevron { transform: rotate(180deg); }
.wc-avatar {
  position: relative;
  display: inline-flex;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(135deg, #463052, #282637);
  box-shadow: inset 0 0 0 1px #ffffff0d;
  color: #e0c7f1;
  font-size: 11px;
  font-weight: 650;
}
.wc-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }
.wc-avatar-classic { color: var(--wc-muted); background: #ffffff04; }

.wc-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  width: 292px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border: 1px solid #ffffff17;
  border-radius: 18px;
  background: linear-gradient(145deg, #211e29, #15141b 70%);
  box-shadow: 0 20px 65px #0008, 0 4px 14px #0005, inset 0 1px 0 #ffffff05;
  transform-origin: top right;
  animation: wc-menu-enter 140ms ease-out;
}
.wc-menu-heading { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px 12px; color: var(--wc-muted); font-size: 11px; font-weight: 600; letter-spacing: .045em; }
.wc-menu-empty { margin: 4px 12px 14px; color: var(--wc-muted); font-size: 12px; line-height: 1.6; }
.wc-menu-heading span { font-size: 10px; font-variant-numeric: tabular-nums; color: #b1a6bd; }
.wc-menu-list { max-height: min(320px, calc(100dvh - 230px)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #51445d transparent; }
.wc-option, .wc-menu-add {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  border: 1px solid transparent;
  border-radius: 11px;
  padding: 8px 10px;
  text-align: left;
  background: transparent;
  color: #e8e3ed;
  transition: background 120ms ease, border-color 120ms ease;
}
.wc-option-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.wc-option[aria-checked=true] { background: #b887e011; border-color: #c8a0e50d; }
.wc-check { margin-left: auto; flex-shrink: 0; color: #d6a9f1; opacity: 0; }
.wc-option[aria-checked=true] .wc-check { opacity: 1; }
.wc-option:hover, .wc-option:focus-visible { background: #ffffff0b; }
.wc-menu-footer { margin-top: 6px; padding-top: 5px; border-top: 1px solid #ffffff0b; }
.wc-menu-footer .wc-option { min-height: 44px; font-size: 12px; color: #b9b2c2; }
.wc-menu-footer .wc-avatar { width: 24px; height: 24px; flex-basis: 24px; border-radius: 7px; }
.working-character-bar .wc-menu-add {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  gap: 10px;
  min-height: 48px;
  margin: 4px 0;
  padding: 11px 12px;
  border-color: #edb6ff40;
  background: linear-gradient(110deg, #7938aa, #a52f79);
  box-shadow: inset 0 1px 0 #ffffff14, 0 3px 16px #b54bb726;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.wc-menu-add::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -50% auto -50% -50%;
  width: 38%;
  background: linear-gradient(90deg, transparent, #ffe6ff30, transparent);
  pointer-events: none;
  animation: wc-marketplace-shimmer 4.8s ease-in-out infinite;
}
.wc-menu-add::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 35px;
  width: 7px;
  height: 7px;
  background: #ffe3fb;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  opacity: 0;
  pointer-events: none;
  animation: wc-marketplace-twinkle 4.8s ease-in-out 1s infinite;
}
.wc-menu-add > svg { flex-shrink: 0; }
.wc-menu-add > span { flex: 1; }
.wc-discover-icon { overflow: visible; }
.wc-discover-icon path { transform-box: fill-box; transform-origin: center; }
.wc-sparkle-main { animation: wc-icon-sparkle 4.8s ease-in-out infinite; }
.wc-sparkle-small { animation: wc-icon-sparkle 4.8s ease-in-out .35s infinite; }
.working-character-bar .wc-menu-add:hover,
.working-character-bar .wc-menu-add:focus-visible {
  border-color: #f1c7ff80;
  box-shadow: inset 0 0 0 30px #ffffff09, 0 4px 20px #b54bb740;
}
.working-character-bar .wc-menu-add:focus-visible { outline-color: #f3d5ff; }
.wc-marketplace-arrow { transition: transform 150ms ease; }
.wc-menu-add:hover .wc-marketplace-arrow { transform: translateX(2px); }

.wc-library-filter { position: relative; display: flex; align-items: center; }
.wc-library-filter select {
  appearance: none;
  -webkit-appearance: none;
  min-height: 42px;
  padding: 9px 34px 9px 12px;
  border: 1px solid var(--wc-border);
  border-radius: 12px;
  background: #17161c;
  color: #bcb5c6;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.wc-library-filter > .wc-chevron { position: absolute; right: 11px; pointer-events: none; }
.working-character-bar [data-filter-label]:has([hidden]),
body:not(:has(#librarySection.active)) .working-character-bar [data-filter-label] { display: none; }

/* Announcements stay available to screen readers; only actionable errors show. */
.wc-status:not([data-error=true]) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wc-status[data-error=true] {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 21;
  width: 292px;
  max-width: calc(100vw - 24px);
  padding: 12px 14px;
  border: 1px solid #89546870;
  border-radius: 12px;
  background: #221b24;
  box-shadow: 0 8px 28px #0006;
  color: #f0bdca;
  font-size: 12px;
  line-height: 1.5;
}
.working-character-bar :focus-visible { outline: 2px solid #bf8ed9; outline-offset: 3px; }
.wc-option:focus-visible, .wc-menu-add:focus-visible { outline-offset: -2px; }

@keyframes wc-menu-enter { from { opacity: 0; transform: translateY(-4px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes wc-marketplace-shimmer {
  0%, 12% { opacity: 0; transform: translateX(0) skewX(-20deg); }
  20% { opacity: 1; }
  46%, 100% { opacity: 0; transform: translateX(430%) skewX(-20deg); }
}
@keyframes wc-icon-sparkle {
  0%, 42%, 100% { opacity: .85; transform: scale(1) rotate(0); }
  21% { opacity: 1; transform: scale(1.18) rotate(12deg); }
}
@keyframes wc-marketplace-twinkle {
  0%, 36%, 100% { opacity: 0; transform: scale(.4) rotate(-15deg); }
  18% { opacity: .9; transform: scale(1) rotate(15deg); }
}
@media (max-width: 600px) {
  .working-character-bar { gap: 6px; }
  .wc-trigger { width: 172px; }
  .wc-library-filter select { max-width: 128px; }
  body:has(.working-character-bar) #topNavbar .vix-topbar-title { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .wc-menu { animation: none; }
  .wc-menu-add::before, .wc-menu-add::after { animation: none; display: none; }
  .wc-sparkle-main, .wc-sparkle-small { animation: none; }
  .wc-trigger, .wc-chevron, .wc-option, .working-character-bar .wc-menu-add, .wc-marketplace-arrow { transition: none; }
}
.working-character-pilot-active #qwenGenCharacterSetting,
.working-character-pilot-active #imageCommandFirstRunCharacters,
.working-character-pilot-active .library-sidebar-section:has(#libTabCharactersCombobox) { display: none !important; }
