@media (max-width: 1023px) {
  .app-shell {
    --sidebar-layout-width: 0px;
  }

  .sidebar {
    width: var(--sidebar-overlay-width);
    min-width: var(--sidebar-overlay-width);
    border-color: transparent;
    background-color: var(--page);
    background-image: var(--sidebar-wash);
    box-shadow: none;
    pointer-events: none;
    transform: translateX(calc(-100% - 1px));
    opacity: 0;
    transition:
      transform 150ms var(--ease-dialog),
      opacity 120ms var(--ease-standard),
      background-color 35ms var(--ease-standard) 75ms,
      border-color 35ms var(--ease-standard) 75ms,
      box-shadow 35ms var(--ease-standard) 75ms;
  }

  .app-shell[data-sidebar-open="true"] .sidebar {
    border-right-color: var(--border);
    background-color: var(--page);
    background-image: var(--sidebar-wash);
    box-shadow: var(--shadow-sidebar);
    pointer-events: auto;
    transform: translateX(0);
    opacity: 1;
    transition:
      transform 150ms var(--ease-dialog),
      opacity 120ms var(--ease-standard),
      background-color 35ms var(--ease-standard),
      border-color 35ms var(--ease-standard),
      box-shadow 35ms var(--ease-standard);
  }

  .sidebar-wordmark {
    visibility: hidden;
    opacity: 0;
  }

  .app-shell[data-sidebar-open="true"] .sidebar-wordmark {
    visibility: visible;
    opacity: 1;
    transition-delay: 0ms;
  }

  .app-shell[data-sidebar-open="true"] .sidebar .item-label,
  .app-shell[data-sidebar-open="true"] .sidebar .item-meta,
  .app-shell[data-sidebar-open="true"] .sidebar .pro-badge,
  .app-shell[data-sidebar-open="true"] .sidebar .profile-name,
  .app-shell[data-sidebar-open="true"] .sidebar .profile-caret,
  .app-shell[data-sidebar-open="true"] .sidebar .sidebar-section-toggle span:not(.icon),
  .app-shell[data-sidebar-open="true"] .sidebar-history,
  .app-shell[data-sidebar-open="true"] #sidebar-more-trigger > .icon:last-child,
  .app-shell[data-sidebar-open="true"] #sidebar-search-trigger {
    visibility: visible;
    transform: none;
    opacity: 1;
    pointer-events: auto;
  }

  .app-shell[data-sidebar-open="true"] .profile-button .profile-avatar {
    transform: none;
  }

  .main-shell {
    left: 0;
    right: var(--main-safe-right);
    transition: background-color var(--duration-surface) var(--ease-standard);
  }

  .sidebar-resize-rail {
    display: none;
  }

  .icon-button.compact-sidebar-trigger {
    display: inline-flex;
  }

  .app-shell[data-sidebar-open="true"] .compact-sidebar-trigger {
    visibility: hidden;
  }

  .app-shell[data-sidebar-open="true"] .sidebar-scrim {
    display: block;
    opacity: 1;
  }

  .home-composer-group {
    top: 280px;
  }

  .main-header {
    padding-left: 40px;
  }

  .thread-reference-inspector {
    position: absolute;
    z-index: var(--z-inspector);
    top: 52px;
    right: 16px;
    bottom: 148px;
    width: min(292px, calc(100% - 32px));
    height: auto;
    min-width: 0;
  }
}


@media (max-width: 704px) {
  .home-composer-group {
    right: 16px;
    left: 16px;
    width: auto;
    transform: none;
  }

  .home-composer-group .composer,
  .home-composer-group .prompt-chips,
  .thread-composer-dock .composer {
    width: 100%;
  }

  .home-greeting {
    font-size: 40px;
    line-height: 46px;
    padding-bottom: 8px;
  }

  .prompt-chips {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-right: 2px;
    padding-left: 2px;
  }

  .settings-dialog {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    display: flex;
    height: 54px;
    min-height: 54px;
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 48px 10px 10px;
    border-right: 0;
    border-bottom: .5px solid var(--border);
  }

  .settings-title {
    display: none;
  }

  .settings-nav-item {
    width: auto;
    min-width: max-content;
    padding-right: 10px;
  }

  .settings-content {
    padding: 28px 20px 48px;
  }

  .library-grid {
    grid-template-columns: 1fr;
  }

  .thread-viewport {
    padding-right: 18px;
    padding-left: 18px;
  }
}

@media (max-height: 620px) {
  .home-composer-group {
    top: 190px;
  }

  .home-greeting {
    display: none;
  }
}

@media (forced-colors: active) {
  .icon {
    background: none;
    color: ButtonText;
  }

  .composer,
  .menu,
  .dialog,
  .pane,
  .library-card {
    border: 1px solid CanvasText;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }

  .stream-caret {
    opacity: 1;
  }

  .icon {
    font-variation-settings: "wght" 500, "opsz" 24, "ANIM" 0, "ANM2" 0 !important;
  }
}

html[data-reduce-motion="true"] *,
html[data-reduce-motion="true"] *::before,
html[data-reduce-motion="true"] *::after {
  scroll-behavior: auto !important;
  animation-duration: .001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
}

html[data-reduce-motion="true"] .stream-caret {
  opacity: 1;
}

html[data-reduce-motion="true"] .icon {
  font-variation-settings: "wght" 500, "opsz" 24, "ANIM" 0, "ANM2" 0 !important;
}

@container content-input-pane (max-width: 430px) {
  .headline-guidance-fields {
    grid-template-columns: 1fr;
  }
}

/* 灵感 Toolbar 复用 copylibrary-toolbar Shell；页面专属只处理搜索框伸展（2026-08-06 · codex） */
.inspiration-toolbar .search-control {
  flex: 1;
  width: auto;
  min-width: 160px;
}

@container inspiration-library (max-width: 680px) {
  .inspiration-toolbar .copylibrary-toolbar-actions {
    flex-wrap: wrap;
  }

  .inspiration-toolbar .search-control {
    flex-basis: 100%;
  }
}

/* Final responsive polish: keep the long workbench toolbars on one shared
   vertical rhythm. The sidebar control intentionally remains in its original
   sidebar / floating location and is not reparented into these headers. */
.page-toolbar-shell.page-header {
  min-height: 52px;
  height: 52px;
  align-items: center;
  padding-block: 6px;
}

.page-header__leading,
.page-toolbar-shell .copylibrary-toolbar-leading,
.page-toolbar-shell .knowledge-toolbar-leading,
.page-toolbar-shell .access-toolbar-leading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.page-toolbar-shell .copylibrary-toolbar-actions,
.page-toolbar-shell .knowledge-toolbar-actions {
  align-items: center;
}

@media (max-width: 680px) {
  .page-toolbar-shell.page-header {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px 10px;
  }

  .page-toolbar-shell .copylibrary-toolbar-leading,
  .page-toolbar-shell .knowledge-toolbar-leading,
  .page-toolbar-shell .access-toolbar-leading,
  .page-header__leading {
    min-width: 0;
    flex: 1 1 auto;
  }

  .page-toolbar-shell .copylibrary-toolbar-actions,
  .page-toolbar-shell .knowledge-toolbar-actions {
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }
}
