/* Shared surface materials that extend button-polish.
   Geometry, hit areas, input borders, gestures and copy stay unchanged. */

:root {
  --xz-highlight: #ffffff14;
  --xz-highlight-strong: #ffffff22;
  --xz-hairline: color-mix(in srgb, var(--soft) 22%, transparent);
  --xz-panel-shadow: 0 18px 44px -18px #00000070, 0 2px 10px #00000022, inset 0 1px 0 var(--xz-highlight);
  --xz-panel-shadow-soft: 0 10px 28px -16px #00000050, 0 1px 4px #00000018, inset 0 1px 0 var(--xz-highlight);
  --xz-glass: color-mix(in srgb, var(--surface) 78%, transparent);
  --xz-glow: color-mix(in srgb, var(--violet) 14%, transparent);
  --xz-motion: .18s ease;
}

html[data-theme="light"] {
  --xz-highlight: #ffffffcc;
  --xz-highlight-strong: #ffffff;
  --xz-hairline: color-mix(in srgb, var(--line) 85%, transparent);
  --xz-panel-shadow: 0 18px 40px -22px #1a1d2a28, 0 2px 8px #1a1d2a10, inset 0 1px 0 var(--xz-highlight);
  --xz-panel-shadow-soft: 0 8px 22px -16px #1a1d2a1c, 0 1px 3px #1a1d2a0c, inset 0 1px 0 var(--xz-highlight);
  --xz-glass: color-mix(in srgb, var(--surface) 88%, transparent);
  --xz-glow: color-mix(in srgb, var(--violet) 12%, transparent);
}

html[data-theme="dark"] {
  --xz-highlight: #ffffff12;
  --xz-highlight-strong: #ffffff1c;
  --xz-hairline: #373737;
  --xz-glass: color-mix(in srgb, #191919 84%, transparent);
  --xz-glow: #ffffff12;
}

html[data-theme="cyan"] {
  --xz-highlight: #d9faff18;
  --xz-highlight-strong: #d9faff28;
  --xz-hairline: color-mix(in srgb, var(--cyan-border, rgba(29, 216, 243, .34)) 65%, var(--line));
  --xz-glass: color-mix(in srgb, var(--surface) 80%, transparent);
  --xz-glow: color-mix(in srgb, var(--violet) 16%, transparent);
}

/* Audio players stay neutral gray in dark and cyan; never inherit cyan glass. */
html[data-theme="cyan"] :is(.cv-node-audio, .cv-node-audio-generation, .xs-node-audio, .cv-audio-player, .xs-preview .cv-audio-player) {
  --xz-highlight: #ffffff12;
  --xz-highlight-strong: #ffffff1c;
  --xz-hairline: #373737;
  --xz-glow: #ffffff10;
  --xz-glass: color-mix(in srgb, #191919 84%, transparent);
}

/* ----- Raised panels, menus and dialogs ----- */
html[data-theme] body :is(
  .theme-picker .theme-menu,
  .history-menu,
  .account-menu,
  .auth-dialog,
  .ac-dialog,
  .xc-dialog,
  .xb-plans-dialog,
  .cloud-consent-dialog,
  .card,
  .credits-card,
  .local-card,
  .development-card,
  .model-catalog,
  .cv-board-panel,
  .cv-inspector,
  .cv-minimap,
  .cv-assets-panel,
  .cv-zoom-menu,
  .cv-return-callout,
  .cv-rail-tooltip,
  .cv-shortcuts,
  .cv-error,
  .xs-share-dialog,
  .xs-share-popover
) {
  background-image: linear-gradient(180deg, var(--xz-highlight), transparent 28%);
  box-shadow: var(--xz-panel-shadow);
}

html[data-theme] body :is(.auth-dialog, .ac-dialog, .xc-dialog, .xb-plans-dialog, .cloud-consent-dialog)::backdrop {
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
}

html[data-theme] body :is(
  .theme-picker .theme-menu,
  .history-menu,
  .account-menu,
  .cv-zoom-menu,
  .cv-board-panel,
  .cv-inspector,
  .cv-minimap,
  .cv-assets-panel,
  .cv-return-callout,
  .cv-action-rail,
  .cv-view-tools,
  .billing-entry
) {
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  backdrop-filter: blur(18px) saturate(120%);
}

html[data-theme="dark"] body :is(
  .theme-picker .theme-menu,
  .history-menu,
  .account-menu,
  .auth-dialog,
  .ac-dialog,
  .xc-dialog,
  .xb-plans-dialog,
  .card,
  .cv-board-panel,
  .cv-inspector,
  .cv-minimap,
  .cv-zoom-menu,
  .cv-rail-tooltip
) {
  background-color: #191919;
}

html[data-theme="dark"] body :is(.credits-card, .local-card, .development-card, .model-catalog, .prompt-card) {
  background-color: #242424;
}

/* ----- Top bar, composer shell, billing capsule ----- */
html[data-theme] body .topbar {
  background-image: linear-gradient(180deg, var(--xz-highlight), transparent 70%);
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--line) 80%, transparent);
}

html[data-theme] body .composer {
  background-image: linear-gradient(180deg, var(--xz-highlight), transparent 36%);
  box-shadow: var(--xz-panel-shadow-soft);
}

html[data-theme] body .billing-entry {
  box-shadow: inset 0 1px 0 var(--xz-highlight), 0 3px 12px var(--xz-button-shadow, #00000020);
}

/* ----- Sidebar: only the open glass overlay is enriched; collapsed rail stays transparent ----- */
@media (min-width: 761px) {
  .workbench > .sidebar.sidebar-peek.is-peek-open {
    background: var(--xz-glass);
    box-shadow: 14px 0 36px color-mix(in srgb, var(--bg) 20%, transparent), inset -1px 0 0 var(--xz-hairline), inset 0 1px 0 var(--xz-highlight);
  }

  .workbench > .sidebar.sidebar-peek.is-peek-open .workspace-nav-item:is(:hover, :focus-visible):not(:disabled),
  .workbench > .sidebar.sidebar-peek.is-peek-open .creation-subnav-item:is(:hover, :focus-visible):not(:disabled) {
    background-image: linear-gradient(115deg, color-mix(in srgb, var(--violet) 10%, transparent), transparent 70%);
    box-shadow: inset 0 1px 0 var(--xz-highlight);
  }
}

/* ----- Menus, tabs, tags: satin hover without changing size or borders ----- */
html[data-theme] body :is(
  .theme-picker .theme-option,
  .account-menu button,
  .history-menu button,
  .history-menu-action,
  .ac-settings-tab,
  .xc-tabs > button,
  .xa-nav-flyout > button,
  .xa-tab,
  .xa-tabs > button,
  .cv-asset-filter,
  .cv-board-row,
  .small-tag,
  .request-state,
  .workspace-badge
) {
  transition: background-color var(--xz-motion), background-image var(--xz-motion), box-shadow var(--xz-motion), color var(--xz-motion), border-color var(--xz-motion);
}

html[data-theme] body :is(
  .theme-picker .theme-option,
  .account-menu button,
  .history-menu button,
  .history-menu-action,
  .ac-settings-tab,
  .xa-nav-flyout > button
):is(:hover, :focus-visible):not(:disabled) {
  background-image: linear-gradient(115deg, color-mix(in srgb, var(--violet) 11%, var(--surface-raised)), var(--surface-raised));
  box-shadow: inset 0 1px 0 var(--xz-highlight);
}

html[data-theme] body :is(.small-tag, .request-state, .workspace-badge) {
  box-shadow: inset 0 1px 0 var(--xz-highlight);
}

html[data-theme] body :is(.message-content, .history-item, .unifiedhistory-row, .xz-image-history-item, .creation-history-item) {
  background-image: linear-gradient(180deg, var(--xz-highlight), transparent 40%);
}

/* ----- Canvas chrome and node sheen (no transform, no port or input-border changes) ----- */
html[data-theme] body .cv-workspace .cv-action-rail,
html[data-theme] body .cv-workspace .cv-view-tools {
  background-color: color-mix(in srgb, var(--surface) 88%, transparent);
  background-image: linear-gradient(180deg, var(--xz-highlight), transparent 55%);
  box-shadow: var(--xz-panel-shadow-soft);
}

html[data-theme="dark"] body .cv-workspace .cv-action-rail,
html[data-theme="dark"] body .cv-workspace .cv-view-tools {
  background-color: color-mix(in srgb, #191919 88%, transparent);
}

html[data-theme] body .cv-workspace .cv-node > .cv-node-surface,
html[data-theme] body .cv-workspace .cv-node-surface {
  background-image: linear-gradient(180deg, var(--xz-highlight-strong), transparent 26%);
}

html[data-theme] body .cv-workspace .cv-node.is-selected > .cv-node-surface {
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--cv-accent, var(--violet)) 16%, transparent), transparent 42%), linear-gradient(180deg, var(--xz-highlight-strong), transparent 26%);
}

html[data-theme] body .cv-top :is(.cv-boards-button, .cv-save, .cv-icon) {
  background-image: linear-gradient(180deg, var(--xz-highlight), transparent 60%);
}

/* ----- Account center and admin workspace ----- */
html[data-theme] body .ac-dialog-header,
html[data-theme] body .xb-heading,
html[data-theme] body .xc-tabs {
  background-image: linear-gradient(180deg, var(--xz-highlight), transparent);
}

html[data-theme] body.xa-admin .xa-nav-flyout,
html[data-theme] body.xa-admin .xa-page :is(.card, .xa-panel),
html[data-theme] body.xa-admin .login-card {
  background-image: linear-gradient(180deg, var(--xz-highlight), transparent 30%);
  box-shadow: var(--xz-panel-shadow-soft);
}

html[data-theme="dark"] body.xa-admin :is(.xa-nav-flyout, .xa-page .card, .xa-page .xa-panel, .login-card) {
  background-color: #191919;
}

html[data-theme] body.xa-admin .xa-tab:is(:hover, :focus-visible, [aria-selected="true"], .is-active):not(:disabled),
html[data-theme] body.xa-admin .xa-tabs > button:is(:hover, :focus-visible, [aria-selected="true"], .is-active):not(:disabled) {
  background-image: linear-gradient(180deg, var(--xz-highlight), color-mix(in srgb, var(--violet) 10%, var(--surface)));
  box-shadow: inset 0 1px 0 var(--xz-highlight);
}

/* ----- Launch atmosphere: extra tint only, no layout or copy, launch.css left untouched ----- */
#launchScreen .launch-haze::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 30% 42%, #ffffff08, transparent 58%);
}

html[data-theme="dark"] #launchScreen .launch-haze::after {
  background: radial-gradient(ellipse at 28% 40%, #ffffff07, transparent 56%);
}

html[data-theme="cyan"] #launchScreen .launch-haze::after {
  background: radial-gradient(ellipse at 30% 42%, rgba(29, 216, 243, .06), transparent 58%);
}

html[data-theme="light"] #launchScreen .launch-haze::after {
  background: radial-gradient(ellipse at 30% 42%, #ffffff0c, transparent 58%);
}

/* ----- Panel entrance: opacity only, so existing transforms stay intact ----- */
@keyframes xz-surface-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

html[data-theme] body :is(
  .theme-picker .theme-menu,
  .history-menu,
  .account-menu,
  .cv-zoom-menu,
  .cv-board-panel,
  .cv-assets-panel
):not([hidden]) {
  animation: xz-surface-in .18s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme] body :is(
    .theme-picker .theme-option,
    .account-menu button,
    .history-menu button,
    .history-menu-action,
    .ac-settings-tab,
    .xc-tabs > button,
    .xa-nav-flyout > button,
    .xa-tab,
    .xa-tabs > button,
    .cv-asset-filter,
    .cv-board-row,
    .small-tag,
    .request-state,
    .workspace-badge,
    .topbar,
    .composer,
    .cv-node-surface,
    .cv-action-rail,
    .cv-view-tools
  ) {
    transition: none;
  }

  html[data-theme] body :is(
    .theme-picker .theme-menu,
    .history-menu,
    .account-menu,
    .cv-zoom-menu,
    .cv-board-panel,
    .cv-assets-panel,
    .auth-dialog,
    .ac-dialog,
    .xc-dialog,
    .xb-plans-dialog
  ) {
    animation: none;
  }

  #launchScreen .launch-haze::after { transition: none; }
}

/* ----- Official 2026-11-17 brand landing: 星核 / 净朗 / layered buttons ----- */

/* 净朗 wordmark: keep the existing sans, tighten tracking only. Subtitle untouched. */
html[data-theme] body .brand strong {
  letter-spacing: .01em;
}

/* Primary: mineral facet. Tokens, radius and outer size stay as already confirmed. */
html[data-theme] body :is(.workbench,.auth-dialog,.ac-dialog,.xc-dialog,.xb-plans-dialog,.admin-shell,.admin-wrap,.admin-dashboard) :is(
  .primary-button,.auth-submit,.xz-image-primary,.ac-primary,.billing-subscribe,.message-edit-confirm,.send-button
),
html[data-theme] body .workbench #chat-command-center .send-button,
html[data-theme] body .workbench .floating-dock :is(.send-button,.xz-image-primary),
html[data-theme] body.xa-admin .xa-button.is-primary {
  background:
    linear-gradient(135deg, #ffffff2a 0 18%, transparent 42%),
    linear-gradient(180deg, #ffffff16, transparent 48%),
    linear-gradient(125deg, var(--xz-button-from), var(--xz-button-to));
  box-shadow:
    inset 0 1px 0 #ffffff55,
    inset 1px 0 0 #ffffff22,
    inset -1px -1px 0 #0000001a,
    0 3px 9px var(--xz-button-glow);
}

html[data-theme] body :is(.workbench,.auth-dialog,.ac-dialog,.xc-dialog,.xb-plans-dialog,.admin-shell,.admin-wrap,.admin-dashboard) :is(
  .primary-button,.auth-submit,.xz-image-primary,.ac-primary,.billing-subscribe,.message-edit-confirm,.send-button
):hover:not(:disabled),
html[data-theme] body .workbench #chat-command-center .send-button:hover:not(:disabled),
html[data-theme] body .workbench .floating-dock :is(.send-button,.xz-image-primary):hover:not(:disabled),
html[data-theme] body.xa-admin .xa-button.is-primary:hover:not(:disabled) {
  background:
    linear-gradient(135deg, #ffffff36 0 20%, transparent 46%),
    linear-gradient(180deg, #ffffff24, transparent 55%),
    linear-gradient(125deg, var(--xz-button-from), var(--xz-button-to));
  box-shadow:
    inset 0 1px 0 #ffffff66,
    inset 1px 0 0 #ffffff28,
    inset -1px -1px 0 #00000014,
    0 4px 13px var(--xz-button-glow);
  transform: none;
}

html[data-theme] body :is(.primary-button,.auth-submit,.xz-image-primary,.ac-primary,.billing-subscribe,.message-edit-confirm,.send-button):active:not(:disabled),
html[data-theme] body.xa-admin .xa-button.is-primary:active:not(:disabled) {
  transform: none;
}

/* Secondary: shallow relief. No change to confirmed base colors or outer size. */
html[data-theme] body :is(.workbench,.auth-dialog,.ac-dialog,.xc-dialog,.xb-plans-dialog,.admin-shell,.admin-wrap,.admin-dashboard) :is(
  .quiet-button,.xz-image-quiet,.ac-secondary,.xb-button,.login-button,
  .payment-button,.unifiedhistory-filter-toggle,.unifiedhistory-page-button,
  .creation-history-pagination button,.history-selection-actions button
),
html[data-theme] body :is(.auth-tabs,.workspace-history-tabs,.xc-tabs) > button,
html[data-theme] body.xa-admin .xa-button:not(.is-primary):not(.is-danger),
html[data-theme] body .workbench .new-chat-button {
  box-shadow: inset 0 1px 0 var(--xz-button-highlight), inset 0 -1px 0 #00000010, 0 1px 3px var(--xz-button-shadow);
}

/* Icon buttons: transparent by default, a well only on hover. No displacement. */
html[data-theme] body .workbench :is(.theme-toggle,.message-tool-button,.message-edit-button,.message-version-button,.icon-button,.history-more),
html[data-theme] body .cv-workspace :is(.cv-top > .cv-icon,.cv-view-button,.cv-rail-button:not(.cv-rail-add),.cv-prompt-tool,.cv-inspector-header > .cv-icon,.cv-dialog-close,.cv-software-close) {
  background-color: transparent;
  background-image: none;
  box-shadow: none;
}

html[data-theme] body .workbench :is(.theme-toggle,.message-tool-button,.message-edit-button,.message-version-button,.icon-button,.history-more):hover:not(:disabled):not([aria-expanded="true"]),
html[data-theme] body .cv-workspace :is(.cv-top > .cv-icon,.cv-view-button,.cv-rail-button:not(.cv-rail-add),.cv-prompt-tool,.cv-inspector-header > .cv-icon,.cv-dialog-close,.cv-software-close):hover:not(:disabled):not(.is-active):not([aria-expanded="true"]):not([aria-pressed="true"]) {
  background-color: color-mix(in srgb, var(--text) 8%, transparent);
  background-image: none;
  box-shadow: inset 0 1px 3px #00000028, inset 0 0 0 1px var(--xz-hairline);
  transform: none;
  filter: none;
}

html[data-theme] body :is(.workbench,.auth-dialog,.ac-dialog,.xc-dialog,.xb-plans-dialog,.admin-shell,.cv-workspace) :is(
  .primary-button,.auth-submit,.send-button,.quiet-button,.icon-button,.theme-toggle,
  .new-chat-button,.cv-icon,.cv-view-button,.cv-rail-button,.xa-button
):is(:hover,:active):not(:disabled) {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme] body :is(.primary-button,.send-button,.quiet-button,.icon-button,.theme-toggle,.new-chat-button,.cv-icon,.cv-view-button) {
    transition: none;
  }
}
