:where([data-bf-theme], .bf-community) {
  --bf-bg: #f4f6fb;
  --bf-panel: #fff;
  --bf-header: #fffffff2;
  --bf-surface: #f1f3fa;
  --bf-line: #dfe4ef;
  --bf-text: #182233;
  --bf-muted: #566278;
  --bf-accent: #484fc7;
  --bf-accent-hover: #373da5;
  --bf-accent-bg: #eef0ff;
  --bf-accent-line: #c6cbf6;
  --bf-on-accent: #fff;
  --bf-cyan: #126b67;
  --bf-error-color: #a22948;
  --bf-error-bg: #fff0f3;
  --bf-error-line: #edbbc9;
  --bf-success-bg: #eaf7f3;
  --bf-success-line: #add8cc;
  --bf-backdrop: #25334e61;
  --bf-shadow: #14213d40;
  --bf-radius: 16px;
  --bf-control-radius: 10px;
  --bf-ui-font: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  color-scheme: light;
}

:where([data-bf-theme='dark'], .bf-community[data-theme='dark']) {
  --bf-bg: #111520;
  --bf-panel: #1a1f2d;
  --bf-header: #181d2af2;
  --bf-surface: #22293b;
  --bf-line: #333c52;
  --bf-text: #eef2ff;
  --bf-muted: #aebad2;
  --bf-accent: #b0b8ff;
  --bf-accent-hover: #cbd0ff;
  --bf-accent-bg: #282e53;
  --bf-accent-line: #515c99;
  --bf-on-accent: #141a39;
  --bf-cyan: #80d5ca;
  --bf-error-color: #ffafc5;
  --bf-error-bg: #362630;
  --bf-error-line: #75485a;
  --bf-success-bg: #1d3437;
  --bf-success-line: #3c6464;
  --bf-backdrop: #060811bb;
  --bf-shadow: #06081192;
  color-scheme: dark;
}

html[data-bf-theme] body {
  margin: 0;
  min-width: 960px;
  background: var(--bf-bg);
}

.bf-community {
  display: flex;
  flex-direction: column;
  min-width: 960px;
  min-height: 100dvh;
  color: var(--bf-text);
  background: var(--bf-bg);
  font: 14px/1.55 var(--bf-ui-font);
}

.bf-community-app {
  height: 100dvh;
  overflow: auto;
}

.bf-community *,
.bf-community *::before,
.bf-community *::after {
  box-sizing: border-box;
}

:where(.bf-community) a {
  color: inherit;
  text-decoration: none;
}

:is(.bf-community, .bf-editor) :is(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--bf-accent);
  outline-offset: 2px;
}

.bf-skip-link {
  position: absolute;
  z-index: 10;
  inset-block-start: -5rem;
  inset-inline-start: 16px;
  border-radius: 9px;
  padding: 8px 12px;
  background: var(--bf-panel);
}

.bf-skip-link:focus {
  inset-block-start: 10px;
}

.bf-community .bf-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--bf-line);
  background: var(--bf-header);
  backdrop-filter: blur(12px);
}

.bf-community :is(.bf-top-inner, .bf-content, .bf-footer) {
  width: min(100% - 72px, 1420px);
  margin: 0 auto;
}

.bf-content {
  flex: 1;
  padding: 34px 0 52px;
}

.bf-content:focus {
  outline: none;
}

.bf-page-heading {
  margin-bottom: 26px;
}

.bf-page-heading h1 {
  margin: 0;
  color: var(--bf-text);
  font-size: 38px;
  font-weight: 750;
  line-height: 1.18;
  letter-spacing: -0.035em;
}

.bf-page-heading p {
  margin: 9px 0 0;
  color: var(--bf-muted);
  font-size: 15px;
}

.bf-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 16px 0 24px;
  border-top: 1px solid var(--bf-line);
  color: var(--bf-muted);
  font-size: 13px;
}

.bf-footer a:hover {
  color: var(--bf-accent);
}

.bf-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: var(--bf-button-height, 38px);
  padding: var(--bf-button-padding, 7px 14px);
  font-size: var(--bf-button-text-size, 13px);
  white-space: nowrap;
}

/* Imperative editor tools retain their control names and sizing. */
:is(
  .bf-button,
  .bf-editor :where(
    .button, .icon-button, .editor-control, .modal-actions > button, .startup-card > button,
    :is(.property-section, .special-attachments-panel, .graph-controls, .dopesheet-controls) button:not([class])
  )
) {
  border: 1px solid var(--bf-line);
  border-radius: var(--bf-control-radius);
  color: var(--bf-text);
  background: var(--bf-panel);
  font-family: var(--bf-ui-font);
  font-weight: 600;
  cursor: pointer;
}

.bf-editor :where(.icon-button:not(.active)) {
  background: transparent;
  border-color: transparent;
}

:is(
  .bf-button,
  .bf-editor :where(
    .button, .icon-button, .editor-control, .modal-actions > button,
    :is(.property-section, .special-attachments-panel, .graph-controls, .dopesheet-controls) button:not([class])
  )
):where(:hover, .active, [aria-pressed='true']):where(:not(:disabled, :has(> input:disabled))) {
  border-color: var(--bf-accent-line);
  color: var(--bf-accent);
  background: var(--bf-accent-bg);
}

:is(.bf-primary, .bf-editor :where(.button.primary, .play-button, .modal-actions .primary, .startup-card > button)) {
  border-color: var(--bf-accent);
  background: var(--bf-accent);
  color: var(--bf-on-accent);
}

:is(.bf-primary, .bf-editor :where(.button.primary, .play-button, .modal-actions .primary, .startup-card > button)):hover:not(:disabled) {
  border-color: var(--bf-accent-hover);
  color: var(--bf-on-accent);
  background: var(--bf-accent-hover);
}

:is(.bf-button, .bf-field, .bf-select, .bf-editor :where(.button, .icon-button, .editor-control)):disabled,
.bf-file-picker:has(> input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.bf-file-picker {
  position: relative;
  cursor: pointer;
}

.bf-file-picker > input[type='file'] {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  margin: 0;
  clip-path: inset(50%);
}

.bf-file-picker:has(> input:focus-visible) {
  outline: 2px solid var(--bf-accent);
  outline-offset: 2px;
}

:is(
  .bf-field, .bf-select,
  .bf-community :where(.field, .bf-publish-field, .bf-image-field) > :where(input, select, textarea),
  .bf-editor :where(
    input:not([type='hidden'], [type='checkbox'], [type='radio'], [type='range'], [type='color'], [type='file'], .number-field input),
    select, textarea, .number-field
  )
) {
  border: 1px solid var(--bf-line);
  border-radius: var(--bf-control-radius);
  color: var(--bf-text);
  background-color: var(--bf-panel);
}

.bf-editor :is(input, textarea)::placeholder,
.bf-field::placeholder {
  color: var(--bf-muted);
  opacity: 1;
}

.bf-editor input[type='file']:not([hidden], .bf-file-picker > input) {
  max-width: 100%;
  color: var(--bf-muted);
  font-family: var(--bf-ui-font);
}

.bf-editor input[type='file']::file-selector-button {
  min-height: 30px;
  margin-inline-end: 8px;
  padding-inline: 10px;
  border: 1px solid var(--bf-line);
  border-radius: var(--bf-control-radius);
  color: var(--bf-text);
  background: var(--bf-panel);
  font: inherit;
  cursor: pointer;
}

.bf-editor input[type='file']:hover:enabled::file-selector-button {
  border-color: var(--bf-accent-line);
  background: var(--bf-accent-bg);
}

.bf-workbench-dialog {
  width: min(1420px, 100vw - 64px);
  height: min(806px, 100dvh - 64px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--bf-line);
  border-radius: 20px;
  color: var(--bf-text);
  background: var(--bf-panel);
  box-shadow: 0 26px 90px var(--bf-shadow);
}

.bf-workbench-dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.bf-workbench-dialog::backdrop {
  background: var(--bf-backdrop);
  backdrop-filter: blur(5px);
}

.bf-workbench-dialog > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--bf-line);
}

.bf-workbench-dialog h2 {
  margin: 0;
  font-size: 18px;
}

.bf-workbench-close {
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 23px;
  font-weight: 400;
  line-height: 1;
}

.bf-workbench-body {
  overflow: auto;
}

.bf-community .bf-top-inner {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  height: 64px;
}

.bf-community-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.05em;
  white-space: nowrap;
}

.bf-community-brand > span {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 9px;
  color: white;
  background: linear-gradient(145deg, #5a62dc, #3f48bc);
  font-size: 20px;
}

.bf-main-nav,
.bf-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.bf-site-icon {
  flex: none;
  width: 1em;
  height: 1em;
}

.bf-community :is(.bf-main-nav > a, .bf-tools-menu summary),
.bf-account-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-radius: 9px;
  color: var(--bf-muted);
  font-weight: 650;
}

.bf-community :is(.bf-main-nav > a:hover, .bf-tools-menu summary:hover, .bf-tools-menu[open] summary),
.bf-account-link:hover {
  color: var(--bf-text);
  background: var(--bf-surface);
}

.bf-community :is(.bf-main-nav > a, .bf-account-link)[aria-current='page'] {
  color: var(--bf-accent);
  background: var(--bf-accent-bg);
}

.bf-account-entry {
  position: relative;
}

.bf-account-link {
  justify-content: center;
  min-width: 38px;
  height: 36px;
  padding-inline: 8px;
  color: var(--bf-text);
  font-variant-numeric: tabular-nums;
}

.bf-account-link .bf-site-icon {
  width: 20px;
  height: 20px;
  color: var(--bf-accent);
}

.bf-tools-menu {
  position: relative;
}

.bf-tools-menu summary {
  list-style: none;
  cursor: pointer;
}

.bf-tools-menu[open] summary .bf-site-icon {
  transform: rotate(180deg);
}

.bf-tools-menu summary::-webkit-details-marker {
  display: none;
}

.bf-tools-links {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  display: grid;
  gap: 3px;
  min-width: 176px;
  padding: 5px;
  border: 1px solid var(--bf-line);
  border-radius: 12px;
  background: var(--bf-panel);
  box-shadow: 0 12px 25px var(--bf-shadow);
}

.bf-tools-links a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 7px;
}

.bf-community .bf-tools-links a:hover {
  color: var(--bf-accent);
  background: var(--bf-accent-bg);
}

.bf-site-search {
  display: flex;
  align-items: center;
  min-width: 0;
  width: min(100%, 380px);
  height: 36px;
  margin: 0;
  padding: 2px 3px 2px 11px;
  border: 1px solid var(--bf-line);
  border-radius: 10px;
  background: var(--bf-surface);
}

.bf-site-search:focus-within {
  border-color: var(--bf-accent);
  background: var(--bf-panel);
}

.bf-community .bf-site-search input[type='search'] {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  outline: none;
  color: var(--bf-text);
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-size: 13px;
}

.bf-site-search input::placeholder {
  color: var(--bf-muted);
  opacity: 1;
}

.bf-community .bf-site-search button {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--bf-muted);
  background: transparent;
}

.bf-site-search button:hover {
  color: var(--bf-accent);
  background: var(--bf-accent-bg);
}

.bf-site-search .bf-site-icon {
  width: 17px;
  height: 17px;
}

.bf-theme-switch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 52px;
  height: 28px;
  min-height: 0;
  padding: 0 6px;
  border: 1px solid var(--bf-line);
  border-radius: 99px;
  color: var(--bf-muted);
  background: var(--bf-surface);
  font: 13px/1 'Segoe UI Symbol', sans-serif;
  cursor: pointer;
}

.bf-theme-switch::before {
  content: '';
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--bf-line);
  border-radius: 50%;
  background: var(--bf-panel);
  box-shadow: 0 1px 3px var(--bf-shadow);
}

.bf-theme-switch span {
  position: relative;
}

.bf-theme-switch[aria-checked='true'] {
  border-color: var(--bf-accent-line);
  background: var(--bf-accent-bg);
}

.bf-theme-switch[aria-checked='true']::before {
  transform: translateX(24px);
}

.bf-select-wrap {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  color: var(--bf-muted);
}

.bf-select-wrap > .bf-site-icon {
  position: absolute;
  inset-inline-end: 9px;
  pointer-events: none;
}

.bf-select {
  appearance: none;
  width: 100%;
  height: 36px;
  min-height: 0;
  padding: 0 29px 0 11px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.bf-editor select:not(.bf-select, [multiple]) {
  appearance: none;
  min-height: 27px;
  padding-inline: 8px 24px;
  background-image:
    linear-gradient(45deg, transparent 48%, var(--bf-muted) 52%),
    linear-gradient(135deg, var(--bf-muted) 48%, transparent 52%);
  background-position: calc(100% - 13px) center, calc(100% - 8px) center;
  background-repeat: no-repeat;
  background-size: 5px 5px;
  cursor: pointer;
}

.bf-language-select {
  min-width: 82px;
}

:is(.bf-select, .bf-theme-switch, .bf-editor :where(select)):hover:enabled {
  border-color: var(--bf-accent-line);
}

@supports (appearance: base-select) {
  :is(.bf-select, .bf-editor select:not([multiple])),
  :is(.bf-select, .bf-editor select:not([multiple]))::picker(select) {
    appearance: base-select;
  }

  :is(.bf-select, .bf-editor select:not([multiple])) {
    align-items: center;
  }

  .bf-editor select:not(.bf-select, [multiple]) {
    padding-inline-end: 8px;
    background-image: none;
  }

  .bf-select-wrap > .bf-select::picker-icon {
    display: none;
  }

  .bf-editor select::picker-icon {
    color: var(--bf-muted);
  }

  :is(.bf-select, .bf-editor select:not([multiple]))::picker(select) {
    margin-block: 5px;
    min-width: max-content;
    max-width: calc(100vw - 48px);
    max-height: min(420px, 55dvh);
    padding: 4px;
    border: 1px solid var(--bf-line);
    border-radius: var(--bf-control-radius);
    color: var(--bf-text);
    background: var(--bf-panel);
    box-shadow: 0 9px 24px var(--bf-shadow);
  }

  :is(.bf-select, .bf-editor select:not([multiple])) option {
    min-height: 30px;
    padding: 5px 9px;
    border-radius: 7px;
  }

  :is(.bf-select, .bf-editor select:not([multiple])) option:is(:checked, :hover, :focus-visible) {
    color: var(--bf-accent);
    background: var(--bf-accent-bg);
  }
}

.bf-community .bf-top-actions .bf-primary {
  margin-left: 4px;
  white-space: nowrap;
}

@media (max-width: 1150px) {
  .bf-community .bf-top-inner {
    width: calc(100% - 38px);
    gap: 10px;
  }

  .bf-community :is(.bf-main-nav > a, .bf-tools-menu summary, .bf-account-link) {
    padding-inline: 8px;
  }

}

.bf-library-types,
.bf-results-toolbar,
.bf-catalog-filters {
  display: flex;
  align-items: center;
  gap: 9px;
}

.bf-library-types {
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--bf-line);
}

.bf-results-toolbar {
  flex-wrap: wrap;
  min-width: 0;
  min-height: 44px;
  margin-inline-start: auto;
}

.bf-catalog-filters .bf-select-wrap {
  min-width: 112px;
}

.bf-catalog-count {
  position: relative;
  margin: 0;
  color: var(--bf-muted);
  font-size: 13px;
  white-space: nowrap;
}

.bf-doc {
  max-width: 840px;
}

.bf-doc nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-block: 0 20px;
  color: var(--bf-muted);
}

.bf-doc a {
  color: var(--bf-accent);
}

.bf-doc section {
  padding: 20px 24px;
  margin-bottom: 12px;
  border: 1px solid var(--bf-line);
  border-radius: var(--bf-radius);
  background: var(--bf-panel);
  scroll-margin-top: 80px;
}

.bf-doc section h2 {
  font-size: 19px;
  margin: 0 0 10px;
}

.bf-doc section p {
  margin: 0 0 10px;
}

.bf-doc section p:last-child {
  margin-bottom: 0;
}
.bf-tag {
  display: inline-block;
  padding: 4px 9px;
  border: 1px solid var(--bf-accent-line);
  border-radius: 6px;
  color: var(--bf-cyan);
  background: var(--bf-surface);
  font-size: 12px;
  font-weight: 650;
}

