/* Match the homepage palette and typography without changing header content or layout. */
.shell > .workspace > .topbar { z-index: 60; }
@media (min-width: 761px) {
  .shell:not(.homepage-reference-shell):not(.library-reference-shell):not(.gallery-shell) > .workspace > .topbar { position: relative; }
}
.homepage-reference-shell .topbar-actions .theme-toggle {
  color: var(--home-shell-muted);
  border-color: var(--home-shell-line);
  background: transparent;
  box-shadow: none;
}
.shell .topbar-actions .theme-toggle .theme-icon-moon { display: block; }
.shell .topbar-actions .theme-toggle .theme-icon-sun { display: none; }
html[data-theme="dark"] .shell .topbar-actions .theme-toggle .theme-icon-moon { display: none; }
html[data-theme="dark"] .shell .topbar-actions .theme-toggle .theme-icon-sun { display: block; }
.shell:not(.homepage-reference-shell) > .workspace > .topbar {
  --topbar-text: #231b35;
  --topbar-muted: #766b84;
  --topbar-line: rgba(124, 99, 145, .23);
  --topbar-surface: rgba(250, 247, 253, .94);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--topbar-text);
  background: var(--topbar-surface);
  border-color: transparent;
  border-radius: 0;
  box-shadow: none;
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
html[data-theme="dark"] .shell:not(.homepage-reference-shell) > .workspace > .topbar,
.dark .shell:not(.homepage-reference-shell) > .workspace > .topbar {
  --topbar-text: #f4f0f8;
  --topbar-muted: #9e94ae;
  --topbar-line: rgba(188, 167, 210, .24);
  --topbar-surface: rgba(14, 10, 26, .96);
}
.shell:not(.homepage-reference-shell) > .workspace > .topbar :is(a, button, input, select, span, strong) { font-family: inherit; }
.shell:not(.homepage-reference-shell) > .workspace > .topbar .discovery-main-nav {
  color: var(--topbar-muted);
  font-size: clamp(14px, 1.16vw, 32px);
}
.shell:not(.homepage-reference-shell) > .workspace > .topbar .discovery-main-nav :is(a, [data-navigation-trigger]) { font-weight: 500; }
.shell:not(.homepage-reference-shell) > .workspace > .topbar :is(.topbar-page-title, .library-current-page) {
  color: var(--topbar-text);
  border-color: var(--topbar-line);
}
.shell:not(.homepage-reference-shell) > .workspace > .topbar :is(a, button):hover { color: #cd76d6; }
.shell:not(.homepage-reference-shell) > .workspace > .topbar .topbar-actions :is(.plaza-create, .recharge-cta) {
  font-size: clamp(12px, 1.02vw, 28px);
  font-weight: 600;
  border-radius: 999px;
}
.shell:not(.homepage-reference-shell) > .workspace > .topbar .topbar-actions .plaza-create {
  color: #fff;
  border-color: #c978e565;
  background: linear-gradient(125deg, #52bdf1 0%, #a977ee 45%, #ef4b9b 100%);
  box-shadow: 0 0 20px #c568e52b;
}
.shell:not(.homepage-reference-shell) > .workspace > .topbar .topbar-actions .recharge-cta {
  color: #bd65aa;
  border-color: #bc589f;
  background: transparent;
  box-shadow: inset 0 0 8px #c967be12;
}
.shell:not(.homepage-reference-shell) > .workspace > .topbar .theme-toggle {
  color: var(--topbar-muted);
  border-color: var(--topbar-line);
  background: transparent;
  box-shadow: none;
}
.shell:not(.homepage-reference-shell) > .workspace > .topbar .plaza-profile-link {
  color: var(--theme-accent-strong);
  border-color: var(--topbar-line);
  background: var(--theme-accent-soft);
}
@media (max-width: 1100px) {
  .shell:not(.homepage-reference-shell) > .workspace > .topbar .discovery-main-nav { font-size: 15px; }
}
@media (max-width: 760px) {
  .shell:not(.homepage-reference-shell) > .workspace > .topbar .discovery-main-nav { font-size: 13px; }
  .shell:not(.homepage-reference-shell) > .workspace > .topbar .topbar-actions :is(.plaza-create, .recharge-cta) { font-size: 10px; }
}
@media (max-width: 420px) {
  .shell:not(.homepage-reference-shell) > .workspace > .topbar .discovery-main-nav { font-size: 12px; }
}
@media (max-width: 350px) {
  .shell:not(.homepage-reference-shell) > .workspace > .topbar .discovery-main-nav { font-size: 11px; }
}

/* Reuse the homepage brand while retaining each page's navigation and controls. */
.page-brand-shell > .workspace > .topbar .plaza-brand-group {
  flex: 1 1 auto;
  min-width: 0;
  gap: clamp(12px, 1.4vw, 28px);
}
.page-brand-shell > .workspace > .topbar .homepage-brand { order: 0; }
.page-brand-shell .homepage-brand strong { font-size: clamp(28px, 2.84vw, 54px); }
.page-brand-shell .homepage-brand-cup {
  width: clamp(35px, 3.42vw, 62px);
  height: clamp(37px, 3.56vw, 64px);
}
.page-brand-shell .homepage-brand > span { font-size: clamp(15px, 1.42vw, 27px); }
.library-reference-shell.page-brand-shell > .workspace > .topbar {
  align-items: center;
  padding-top: 0;
  padding-left: 24px;
}
.chat-page .page-brand-shell .homepage-brand strong { font-size: 32px; }
.chat-page .page-brand-shell .homepage-brand-cup { width: 40px; height: 42px; }
.chat-page .page-brand-shell .homepage-brand > span { font-size: 17px; }
@media (max-width: 1600px) {
  .page-brand-shell .homepage-brand > span { display: none; }
}
@media (max-width: 1200px) and (min-width: 761px) {
  .page-brand-shell > .workspace > .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 44px 28px;
    align-content: center;
    align-items: center;
    height: 110px;
    gap: 8px 14px;
    padding: 10px 20px;
  }
  .page-brand-shell > .workspace > .topbar .plaza-brand-group { display: contents; }
  .page-brand-shell .homepage-brand { grid-column: 1; grid-row: 1; width: fit-content; }
  .page-brand-shell .homepage-brand strong { font-size: 32px; }
  .page-brand-shell .homepage-brand-cup { width: 38px; height: 40px; }
  .page-brand-shell > .workspace > .topbar .discovery-main-nav { grid-column: 1; grid-row: 2; }
  .page-brand-shell > .workspace > .topbar .topbar-actions { grid-column: 2; grid-row: 1; }
  .page-brand-shell > .workspace > .topbar .plaza-search { grid-column: 2; grid-row: 2; width: 100%; }
  .page-brand-shell .library-current-page { grid-column: 2; grid-row: 2; justify-self: end; }
  .library-reference-shell.page-brand-shell { --library-header-height: 110px; }
  .chat-page .page-brand-shell > .workspace > .topbar { flex-basis: 110px; }
}
@media (max-width: 900px) and (min-width: 761px) {
  .page-brand-shell .homepage-brand { gap: 4px; }
  .page-brand-shell .homepage-brand strong { font-size: 28px; }
  .page-brand-shell .homepage-brand-cup { width: 34px; height: 36px; }
}
@media (max-width: 760px) {
  .page-brand-shell > .workspace > .topbar {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    grid-template-rows: 38px 28px;
    align-content: center;
    align-items: center;
    height: auto;
    min-height: 98px;
    gap: 8px 6px;
    padding: 10px 12px;
  }
  .page-brand-shell > .workspace > .topbar .plaza-brand-group { display: contents; }
  .page-brand-shell > .workspace > .topbar .plaza-brand-group > [data-action="sidebar-toggle"] { grid-column: 1; grid-row: 1; }
  .page-brand-shell .homepage-brand { grid-column: 2; grid-row: 1; width: fit-content; gap: 4px; }
  .page-brand-shell .homepage-brand strong { font-size: 23px; }
  .page-brand-shell .homepage-brand-cup { width: 26px; height: 28px; }
  .page-brand-shell > .workspace > .topbar .discovery-main-nav { grid-column: 1 / -1; grid-row: 2; }
  .page-brand-shell > .workspace > .topbar .topbar-actions { grid-column: 3; grid-row: 1; flex-basis: auto; gap: 5px; }
  .page-brand-shell > .workspace > .topbar .plaza-search { grid-column: 1 / -1; grid-row: 3; }
  .page-brand-shell .library-current-page { grid-column: 3; grid-row: 2; justify-self: end; }
  .library-reference-shell.page-brand-shell { --library-header-height: 98px; }
  .library-reference-shell.page-brand-shell > .workspace > .topbar { padding: 10px 12px; }
  .page-brand-shell > .workspace > .topbar .topbar-actions :is(.plaza-create, .recharge-cta) { padding-inline: 7px; }
  body.chat-page .page-brand-shell > .workspace > .topbar { display: none; }
}
@media (max-width: 420px) {
  .page-brand-shell > .workspace > .topbar {
    grid-template-rows: 32px 38px 28px;
    min-height: 130px;
    gap: 6px;
  }
  .page-brand-shell .homepage-brand { grid-column: 2 / -1; }
  .page-brand-shell .homepage-brand-cup { display: none; }
  .page-brand-shell .homepage-brand strong { font-size: 21px; }
  .page-brand-shell > .workspace > .topbar .topbar-actions { grid-column: 1 / -1; grid-row: 2; }
  .page-brand-shell > .workspace > .topbar .discovery-main-nav { grid-row: 3; }
  .page-brand-shell .library-current-page { grid-row: 3; }
  .page-brand-shell > .workspace > .topbar .plaza-search { grid-row: 4; }
  .library-reference-shell.page-brand-shell { --library-header-height: 130px; }
}
