.aurora-fill { display: none }

/* Apply the desktop treatment to the chrome itself. Child controls use their own surfaces. */
@media (width > 760px) {
  :root {
    --pic-surface: #000;
    --pic-text: #f5f5f5;
    --pic-muted: #aaa9ad;
    --pic-accent: #dedede;
    --pic-focus: #b8b8b8;
    --pic-field: var(--ip-workspace-field);
    --pic-field-active: var(--ip-workspace-hover);
    --pic-field-focus: var(--ip-workspace-focus);
  }

  :root :is(#app, #scene, #root, .photo-auth-host, .creative-space-panel) :where(
    .auth-dialog, .panel,
    .creative-ribbon, .creative-brandbar:not(.creative-shell *), .rail:not(#creative-sidebar),
    .canvas-composer, .canvas-home-settings, .canvas-home-skills,
    .canvas-home-references, .canvas-board-dialog, .photo-composer,
    .room-tools, .room-inspector, .ip-account-panel
  ),
  :root :is(.creative-space-panel, .creative-rail-hint) {
    --ink: var(--pic-text);
    --muted: var(--pic-muted);
    --edge: transparent;
    --ip-edge: transparent;
    --ip-ink: var(--pic-text);
    --ip-secondary: var(--pic-muted);
    --ip-workspace-text: var(--pic-text);
    --ip-workspace-muted: var(--pic-muted);
    --ip-workspace-emphasis: #ceced1;
    --ip-workspace-control: #202022;
    --ip-workspace-hover: #2d2d31;
    --ip-workspace-focus: var(--pic-focus);
    --ip-workspace-accent-ink: var(--pic-accent);
    --pic-field: #292929;
    --pic-field-active: #373737;
    --pic-field-focus: #929292;
    --billing-text: var(--pic-text);
    --billing-muted: var(--pic-muted);
    --billing-accent-ink: var(--pic-accent);
    --auth-muted: var(--pic-muted);
    --auth-focus: var(--pic-focus);
    --auth-primary-ink: var(--pic-accent);
    background-color: var(--pic-surface);
    border-color: transparent;
    color: var(--pic-text);
    color-scheme: dark;
  }

  /* Use the desktop surface on the creative panels. */
  #app .creative-shell :is(.creative-ribbon, .canvas-composer, .photo-composer) {
    background: var(--pic-surface);
  }
  .aurora-fill {
    display: block;
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(90deg, #132e47, #16323a 50%, #132e47);
  }
  .aurora-fill > .aurora-container { display: block }
  .photo-auth-host #auth-submit:not(.auth-asset-button) {
    position: relative;
    isolation: isolate;
    color: white;
    text-shadow: 0 1px 3px #0a1238;
  }
  #auth-submit > .aurora-fill { z-index: -1 }

  :root .ip-account {
    --ip-account-surface: var(--pic-surface);
    --ip-account-inset: #1a1a1a;
    --ip-account-hover: #292929;
    --ip-account-muted: var(--pic-muted);
  }
  :root .photo-auth-host {
    --auth-surface: var(--pic-surface);
    --auth-field: var(--pic-field);
    --auth-border: transparent;
    --auth-primary: var(--pic-surface);
    --auth-primary-ink: var(--pic-accent);
    --ip-action: var(--pic-text);
  }
  #app .creative-shell .canvas-composer-icon { color: var(--pic-muted) }
  #app :is(.billing-feedback.error, .notice[role="alert"]) { color: var(--ip-workspace-error) }
  #app .catalog-tabs a[aria-current],
  #app .creative-library-categories button[aria-pressed='true'] { box-shadow: none }

  :root :is(#app, #scene, #root, .photo-auth-host, .creative-space-panel)
    :is(button, a):not(:where(.asset-history-tile)):focus-visible {
    outline: 2px solid var(--ip-workspace-focus);
    outline-offset: 2px;
  }
  :root :is(#app, #scene, #root, .photo-auth-host, .creative-space-panel)
    :is(button, a):is([aria-pressed='true'], [aria-selected='true'], [aria-current='page'], [aria-expanded='true']) {
    font-weight: 650;
  }
  :root .photo-auth-host #auth-submit:not(.auth-asset-button):enabled:hover { color: white }
  .photo-auth-host .auth-dialog .auth-tabs,
  .photo-auth-host .auth-dialog .auth-tabs button { border-bottom: 0 }
  .photo-auth-host .auth-tabs button > span { position: relative }
  .photo-auth-host .auth-tabs button > span::after {
    content: '';
    position: absolute;
    inset: auto 0 -5px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--auth-switch-time) var(--auth-switch-ease);
  }
  .photo-auth-host #login-tab > span::after { transform-origin: right }
  .photo-auth-host .auth-tabs button[aria-pressed='true'] > span::after { transform: scaleX(1) }
}

/* Coser elevation: contact shadows sit under controls, wider shadows under
   cards, and a longer falloff under overlays. Each compound control casts once. */
@media (width > 760px) {
  :root {
    --pic-contact-shadow: 0 1px 3px rgb(0 0 0 / 36%), 0 6px 14px rgb(0 0 0 / 34%);
    --pic-card-shadow: 0 3px 9px rgb(0 0 0 / 40%), 0 18px 42px -14px rgb(0 0 0 / 76%);
    --pic-overlay-shadow: 0 7px 26px rgb(0 0 0 / 48%), 0 18px 54px -12px rgb(0 0 0 / 86%);
  }
  :root[data-appearance='light'] {
    --pic-contact-shadow: 0 1px 3px rgb(20 23 28 / 8%), 0 6px 14px rgb(25 25 35 / 5.5%);
    --pic-card-shadow: 0 3px 9px rgb(20 23 28 / 5%), 0 18px 42px -14px rgb(0 0 0 / 35%);
    --pic-overlay-shadow: 0 7px 26px rgb(20 20 24 / 12%), 0 18px 54px -12px rgb(0 0 0 / 22%);
  }
  :root :is(#app, #scene, #root) :is(
    .ip-mast .ip-actions > a, .ip-account-entry,
    .canvas-new-icon, .catalog-tabs a, .photo-stream-search,
    .photo-bottom, .photo-quiet-button, .asset-search, .billing-balance-link,
    .billing-buy, .billing-primary, .billing-secondary, .billing-close) {
    box-shadow: var(--pic-contact-shadow);
  }
  :root :is(#app, #scene, #root) :is(.canvas-composer, .photo-composer,
    .canvas-library-card, .empty, .panel, .projectcard,
    .food-genre-link, .asset-workspace-tile, .photo-stack-card,
    .billing-cover, .billing-surface, .billing-pack, .billing-plan, .membership-table,
    .flow-rail, .flow-dock, .room-tools, .agent-input, .node-generator) {
    box-shadow: var(--pic-card-shadow);
  }
  :root :is(#app, #scene, #root, .photo-auth-host) :is(dialog, .ip-account-panel,
    .canvas-home-settings, .canvas-home-skills,
    .flow-popup, .agent-pop, .asset-preview, .agent-sidecar, .side-list, .room-inspector),
  body > :is(.creative-space-panel, .creative-rail-hint) {
    box-shadow: var(--pic-overlay-shadow);
  }
}

/* Coser desktop uses independent scale so existing placement transforms survive. */
@media (width > 760px) and (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  :root {
    --pic-hover-motion: 200ms cubic-bezier(.2,.8,.2,1);
  }
  :root :is(#app, #scene, #root, .photo-auth-host, .creative-space-panel)
    :is(button, [role='button'], a[href]):not(:where(
      .auth-asset-button, .creative-shell .creative-brandbar *, #creative-sidebar *, .studio-liquid-dock a,
      .photo-stack-card, .photo-stack-trigger, .asset-workspace .asset-history-tile, .board-print, .react-flow__handle, .react-flow__edge, .wire-hit, [draggable='true'], .flow-node *,
      .outpaint-frame > button, .outpaint-controls button, .agent-sidecar button, .photo-action-toolbar button, .generator-toolbar button
    )) {
    transition: scale var(--pic-hover-motion), transform .2s, color .2s, background-color .2s,
      box-shadow .2s, opacity .2s, padding var(--creative-rail-duration, .2s) var(--ip-ease),
      margin var(--creative-rail-duration, .2s) var(--ip-ease);
    &:not(:disabled, [aria-disabled='true']):hover:not(:has(:is(a[href], button, [role='button']):hover)) { scale: 1.05 }
    &:not(:disabled, [aria-disabled='true'], .asset-history-tile):active:not(:has(:is(a[href], button, [role='button']):active)) { scale: .96 }
  }
  #app .explore-gallery .asset-history-tile:hover { z-index: 1 }
  #app .canvas-board-link:hover img { transform: none }
}

@media (width > 760px) {
  :root :is(#app, #scene, #root, .photo-auth-host) {
    :is(input:not(.agent-pick-search input, [type='button'], [type='submit'], [type='reset'], [type='image'], [type='file'],
        [type='color'], [type='checkbox'], [type='radio'], [type='range'], [type='hidden']),
        textarea:not(.outpaint-prompt textarea,.agent-sidecar textarea), select, [contenteditable='true'], [contenteditable='plaintext-only']):not(:where(
          .model-search input, .prompt-entry [contenteditable], .photo-composer textarea
        )) {
      background-color: var(--pic-field);
      border-color: transparent;
      color: var(--ip-workspace-text);
      caret-color: currentColor;
      &::placeholder { color: var(--ip-workspace-muted); opacity: 1 }
      &:focus {
        background-color: var(--pic-field-active);
        border-color: transparent;
        outline: none;
        box-shadow: none;
      }
    }
    :is(input[type='checkbox'], input[type='radio'], input[type='range']) {
      accent-color: var(--pic-field-focus);
    }
    :is(input[type='checkbox'], input[type='radio'], input[type='range'], input[type='file'], input[type='color']):focus-visible {
      outline: 2px solid var(--pic-field-focus);
      outline-offset: 2px;
    }

    /* A compound field has one continuous surface around its icon, text and suffix. */
    :is(.auth-email-field, .photo-stream-search, .asset-search, .asset-searchbar label,
        .record-search-field, .creative-shell .canvas-composer) {
      background: var(--pic-field);
      border-color: transparent;
      &:has(:is(input, textarea, .canvas-composer-prompt):focus) {
        background: var(--pic-field-active);
        border-color: transparent;
        outline: none;
        box-shadow: var(--pic-contact-shadow);
      }
      & > :is(input, textarea), & > :is(input, textarea):focus,
      .canvas-composer-prompt, .canvas-composer-prompt:focus {
        background: transparent;
        border-color: transparent;
        outline: none;
        box-shadow: none;
      }
    }
    .canvas-composer :is(.canvas-composer-icon, .canvas-composer-key) {
      background-color: transparent;
    }
  }
}

/* Desktop space for scaled controls and cards, including the edges of scroll lists. */
@media (width > 760px) {
  :root {
    --pic-hover-control-gap: 8px;
    --pic-hover-card-gap: clamp(20px, 1.5vw, 24px);
  }

  #app :is(.creative-shell .ip-mast .ip-actions, .asset-workspace-actions,
    .asset-workspace-toolbar, .billing-header-actions) {
    gap: 12px;
  }
  #app :is(.canvas-composer-tools, .canvas-composer-files, .canvas-home-quick-skills,
    .canvas-home-setting-options, .catalog-tabs, .billing-nav, .billing-segment, .billing-filters,
    .billing-subscription-actions, .photo-stream-tools, .photo-batch-actions, .photo-result-actions,
    .creative-library-categories) {
    gap: var(--pic-hover-control-gap);
  }
  #app .asset-workspace-tabs { padding: 3px 5px }
  #app :is(.canvas-library-grid, .tools-grid,
    .asset-workspace-grid, .food-genre-grid, .billing-plan-grid, .billing-pack-grid,
    .projectgrid) {
    gap: var(--pic-hover-card-gap);
  }
  #app .creative-shell :is(.railnav, .canvas-home-rail nav) { gap: 6px }
  #app .creative-shell .canvas-rail-board-tools { gap: 4px }
  #app .creative-shell:not(.creative-compact) .canvas-rail-board:is(:hover:not([data-hover-paused] *), :has(:focus-visible, :popover-open)) .canvas-rail-board-link {
    padding-inline-end: 62px;
  }
  #app :is(.canvas-card-menu, .canvas-home-skills, .canvas-rail-board-menu) {
    padding: 8px;
    gap: 4px;
  }
  #app .home-reference-options { gap: 5px; padding: 5px 3% }
  #app .creative-library-content .creative-library-assets { padding-inline: 3% }
  #app :is(.billing-segment, .billing-filters) { padding: 6px }
  .photo-auth-host .auth-alternatives { row-gap: 6px }

  :root :is(#app, #scene) .ip-account-links { gap: 6px }

  #scene .graph-mode :is(.flow-project, .flow-top-actions, .flow-dock) {
    gap: var(--pic-hover-control-gap);
  }
  #scene .graph-mode :is(.project-switch, .flow-top-actions > div) {
    gap: 6px;
    padding: 4px;
  }
  #scene .graph-mode .project-switch { margin-inline-end: 0 }
  #scene .graph-mode .flow-dock { height: auto; padding: 5px }
  #scene .graph-mode .flow-rail { gap: 4px; padding-block: 5px }
  #scene .graph-mode .local-projects { gap: 5px; padding: 4px 8px }
  #scene .graph-mode .board-row-actions { gap: 5px; padding: 8px }
  #scene .graph-mode :is(.side-list, .side-thread-actions, .generator-source-menu) { gap: 6px }
  #scene .graph-mode :is(.original-actions, .viewer-head) { gap: 6px; padding: 6px }
  #scene :is(#viewer .viewer-modes, .image-editor-dialog .image-ref-tabs) { gap: 6px }
  #scene .graph-mode :is(.record-list, .canvas-context-boards > div, .agent-skill-list) {
    gap: 5px;
    padding: 5px 3%;
  }
  #scene .graph-mode .record-filters { gap: 5px; padding: 4px 6px 0 }
  #scene .graph-mode .flow-popup > .flow-options { display: grid; gap: 4px }
  #scene .graph-mode .node-tag-colors { gap: 4px }
  #scene .graph-mode .asset-results { padding: 5px 6px }
  #scene .graph-mode #inspector .node-actions { gap: 7px }
  #scene .graph-mode .model-picker-list { gap: 6px; padding: 5px 3% }
  :root #scene .graph-mode .flow-popup[aria-label='选择模型'] { padding-inline: 12px }
  :root #scene .graph-mode .flow-popup[aria-label='添加参考'] { padding: 6px 8px }
  #scene .graph-mode .camera-selector { padding-inline: 6px }
  #scene .graph-mode .camera-wheel .flow-preset-row { inset-inline: 6px }
  #scene .graph-mode .flow-popup.modal .camera-reset { inset-inline-end: 70px }
  #scene .graph-mode .flow-preset-content:has(.palette-options) { padding: 6px 10px }
  :root #scene .graph-mode .flow-popup[aria-label='图片尺寸选项'] .image-output-options {
    gap: 6px;
    padding: 5px;
  }
  :root #scene .graph-mode .agent-sidecar[data-window-mode] > header { gap: 6px }
  :root #scene .agent-sidecar .agent-input-tools { gap: 6px }

  #root .react-flow__controls { gap: 4px; padding: 4px }

  /* Icon and text actions on a shared surface use the row or toolbar as their background. */
  :root #app :is(.creative-ribbon button, .creative-rail-toggle, .creative-recents-add,
    .canvas-composer-icon, .canvas-composer-key,
    .canvas-card-menu button, .canvas-rail-board-menu button, .photo-parameter-trigger:not([aria-expanded='true']),
    .billing-nav a:not([aria-current]), .billing-close, .home-reference-local):is(:hover, :active, [aria-expanded='true']),
  :root :is(#app, #scene) :is(.ip-account-copy, .ip-account-session button,
    .ip-account-links :is(a, button):not([aria-pressed='true'])):is(:hover, :active),
  :root #scene #viewer .viewer-modes button:not([aria-pressed='true']):is(:hover, :active),
  :root #scene .graph-mode :is(.board-row-more, .project-node-summary,
    .flow-rail .rail-tool, .flow-dock > .flow-tool:not(.pointer-tool),
    .flow-top-actions > div .flow-tool, .side-thread-row .flow-tool,
    .side-thread-actions button, .chat-copy-wrap button,
    .agent-input-tools .flow-tool:not(.agent-model, .agent-send),
    .agent-context-chip .ref-dismiss, #use-reference, #inline-reference,
    #model-menu, #size-menu, #expand-generator):is(:hover, :active, [aria-expanded='true']) {
    background-color: transparent;
  }
}
