/*
 * gpt-theme.css — ChatGPT 风格的界面层（2026-11-05）
 * 叠加在 styles.css 之后加载，只改外观和布局，不改任何交互逻辑。
 * 回滚：删掉 index.html 里这一行 <link> 即可恢复旧界面。
 */

:root {
  --gpt-bg: #ffffff;
  --gpt-sidebar: #f9f9f9;
  --gpt-hover: #ececec;
  --gpt-active: #e3e3e3;
  --gpt-ink: #0d0d0d;
  --gpt-muted: #5d5d5d;
  --gpt-faint: #8f8f8f;
  --gpt-line: #e5e5e5;
  --gpt-bubble: #f4f4f4;
  --gpt-chip: #f4f4f4;
  --gpt-blue: #0169cc;
  --gpt-blue-soft: #e5f1ff;
  --gpt-surface: #ffffff;
  --gpt-on-ink: #ffffff;
  --gpt-ink-hover: #2f2f2f;
  --gpt-disabled: #d7d7d7;
  --gpt-on-disabled: #ffffff;
  --gpt-overlay: rgba(255, 255, 255, 0.88);
  --gpt-press: rgba(0, 0, 0, 0.06);
  --gpt-input-border: #d9d9d9;
  --gpt-error-bg: #fdecea;
  --gpt-shimmer: rgba(255, 255, 255, 0.55);
  --gpt-sidebar-width: 260px;
  --gpt-chat-column: 768px;
  --gpt-image-column: 880px;
  --gpt-radius-composer: 28px;
  --gpt-shadow-composer: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 4px 18px rgba(0, 0, 0, 0.06);
  --gpt-shadow-menu: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 12px 32px rgba(0, 0, 0, 0.12);
  --chat-column: var(--gpt-chat-column);
  --image-column: var(--gpt-image-column);
  font-family: ui-sans-serif, -apple-system, system-ui, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", Helvetica, Arial, sans-serif;
}

html body {
  background: var(--gpt-bg);
  color: var(--gpt-ink);
  -webkit-font-smoothing: antialiased;
}

html body[data-session-type="chat"] {
  --composer: var(--gpt-chat-column);
}

html body[data-session-type="image"] {
  --composer: var(--gpt-image-column);
}

/* ---------- 侧边栏 ---------- */

html body .rail {
  background: var(--gpt-sidebar);
  border-right: 0;
  gap: 8px;
  padding: 10px 8px;
}

html body .rail-btn,
html body .rail-account,
html body .rail-api-key {
  border-radius: 10px;
  color: var(--gpt-muted);
}

html body .rail-btn:hover,
html body .rail-account:hover,
html body .rail-api-key:hover {
  background: var(--gpt-hover);
  color: var(--gpt-ink);
}

html body .history-panel {
  gap: 2px;
  padding: 8px 8px 10px;
  border-right: 0;
  background: var(--gpt-sidebar);
  font-size: 14px;
}

html body .history-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 4px 0 8px;
  margin-bottom: 6px;
}

html body .sidebar-logo {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  overflow: hidden;
  flex: 0 0 auto;
}

html body .sidebar-logo img {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: block;
}

html body .history-head strong {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
}

html body .history-head .icon-btn {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--gpt-muted);
}

html body .history-head .icon-btn:hover {
  background: var(--gpt-hover);
  color: var(--gpt-ink);
}

html body .new-row {
  display: flex;
  flex-direction: column;
  gap: 0;
}

html body .new-chat-wide,
html body .sidebar-api-docs-btn {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--gpt-ink);
  font-size: 14px;
  font-weight: 400;
  box-shadow: none;
}

html body .new-chat-wide:hover,
html body .sidebar-api-docs-btn:hover {
  background: var(--gpt-hover);
}

html body .new-chat-wide svg,
html body .sidebar-api-docs-btn svg,
html body .new-chat-wide i,
html body .sidebar-api-docs-btn i {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
  color: var(--gpt-ink);
}

html body .sidebar-api-key-btn.is-active {
  color: var(--gpt-blue);
}

html body .sidebar-api-key-btn.is-active svg {
  color: var(--gpt-blue);
}

html body .history-tools {
  gap: 4px;
  margin-top: 2px;
}

html body .history-search {
  min-height: 36px;
  padding: 0 10px;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

html body .history-search:hover {
  background: var(--gpt-hover);
}

html body .history-search:focus-within {
  background: var(--gpt-surface);
  box-shadow: 0 0 0 1px var(--gpt-line);
}

html body .history-search input {
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
}

html body .history-search svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

html body .history-filters {
  gap: 4px;
  padding: 4px 6px 0;
}

html body .history-filter {
  min-height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--gpt-muted);
  font-size: 12px;
  font-weight: 500;
}

html body .history-filter:hover {
  background: var(--gpt-hover);
}

html body .history-filter.is-active {
  background: var(--gpt-active);
  color: var(--gpt-ink);
}

html body .history-pack-actions {
  gap: 4px;
  padding: 0 6px;
}

html body .history-mini-btn {
  min-height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--gpt-faint);
  font-size: 12px;
  font-weight: 500;
}

html body .history-mini-btn:hover {
  background: var(--gpt-hover);
  color: var(--gpt-ink);
}

html body .history-mini-btn svg {
  width: 14px;
  height: 14px;
}

html body .conversation-list {
  gap: 0;
  padding: 0;
  margin-top: 6px;
}

html body .conversation-group-label {
  padding: 14px 10px 6px;
  color: var(--gpt-faint);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
}

html body .conversation-group-label:first-child {
  padding-top: 6px;
}

html body .conversation-item {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
}

html body .conversation-item:hover {
  background: var(--gpt-hover);
}

html body .conversation-item.is-active {
  background: var(--gpt-active);
}

html body .conversation-open {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  background: transparent;
  text-align: left;
}

html body .conversation-open span {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--gpt-ink);
  font-size: 14px;
  font-weight: 400;
}

html body .conversation-open span svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  color: var(--gpt-faint);
}

html body .conversation-open small {
  display: none;
}

html body .conversation-actions {
  position: absolute;
  top: 50%;
  right: 4px;
  display: flex;
  gap: 0;
  padding-left: 18px;
  transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, var(--gpt-hover) 16px);
  border-radius: 0 10px 10px 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

html body .conversation-item.is-active .conversation-actions {
  background: linear-gradient(90deg, transparent, var(--gpt-active) 16px);
}

html body .conversation-item:hover .conversation-actions,
html body .conversation-item:focus-within .conversation-actions {
  opacity: 1;
  pointer-events: auto;
}

html body .conversation-mini,
html body .conversation-delete {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--gpt-muted);
}

html body .conversation-mini:hover,
html body .conversation-delete:hover {
  background: var(--gpt-press);
  color: var(--gpt-ink);
}

html body .conversation-delete:hover {
  color: #d03a2f;
}

html body .conversation-mini svg,
html body .conversation-delete svg {
  width: 15px;
  height: 15px;
}

html body .conversation-empty {
  padding: 14px 10px;
  color: var(--gpt-faint);
  font-size: 13px;
}

html body .history-foot {
  gap: 2px;
  padding-top: 8px;
  border-top: 0;
}

html body .balance-card,
html body .user-row {
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

html body .balance-card:hover,
html body .user-row:hover {
  background: var(--gpt-hover);
}

html body .balance-card small,
html body .user-row small {
  color: var(--gpt-faint);
  font-size: 12px;
  font-weight: 400;
}

html body .balance-card strong,
html body .user-row strong {
  color: var(--gpt-ink);
  font-size: 14px;
  font-weight: 500;
}

html body .avatar-small {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

html body .history-backdrop.is-open {
  background: rgba(0, 0, 0, 0.28);
}

/* 桌面端：侧边栏展开时就是 ChatGPT 的 260px 侧栏，收起时退化成窄图标栏 */
@media (min-width: 861px) {
  html body .app-shell.history-pinned {
    --rail: 0px;
    --history-width: var(--gpt-sidebar-width);
    grid-template-columns: var(--gpt-sidebar-width) minmax(0, 1fr);
  }

  html body .app-shell.history-pinned > .rail {
    display: none;
  }

  html body .app-shell.history-pinned .history-panel,
  html body .app-shell.history-pinned #sidebar.history-panel {
    grid-column: 1;
    border-right: 0;
    background: var(--gpt-sidebar);
  }

  html body .app-shell.history-pinned .workspace {
    grid-column: 2;
  }

  html body .app-shell:not(.history-pinned) .history-panel {
    width: var(--gpt-sidebar-width);
  }
}

/* ---------- 顶栏（登录后也显示，和 ChatGPT 一样左上角是模型切换） ---------- */

html body .workspace {
  grid-template-rows: 56px minmax(0, 1fr) auto;
  background: var(--gpt-bg);
}

html body .app-shell:not(.is-guest) .workspace {
  grid-template-rows: 56px minmax(0, 1fr) auto;
}

html body .app-shell:not(.is-guest) .workspace > .topbar,
html body .workspace > .topbar {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 0 12px 0 14px;
  border-bottom: 0;
  background: var(--gpt-bg);
  position: relative;
  z-index: calc(var(--z-dropdown) + 5);
}

html body .brand-switch {
  display: flex;
  align-items: center;
  gap: 4px;
}

html body .brand-name {
  min-height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--gpt-ink);
  font-size: 18px;
  font-weight: 500;
}

html body .topbar .chat-model-picker {
  position: relative;
  display: none;
}

html body[data-session-type="chat"] .app-shell:not(.is-guest) .topbar .chat-model-picker {
  display: block;
}

html body[data-session-type="chat"] .app-shell:not(.is-guest) .topbar .brand-name {
  display: none;
}

html body .topbar .chat-model-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--gpt-ink);
  font-size: 18px;
  font-weight: 500;
  box-shadow: none;
}

html body .topbar .chat-model-btn:hover,
html body .topbar .chat-model-btn[aria-expanded="true"] {
  background: var(--gpt-bubble);
}

html body .topbar .chat-model-btn svg {
  width: 16px;
  height: 16px;
  color: var(--gpt-faint);
}

html body .topbar .chat-model-menu {
  position: absolute;
  top: calc(100% + 6px);
  bottom: auto;
  right: auto;
  left: 0;
  min-width: 300px;
  max-height: min(460px, 70vh);
  padding: 6px;
  border: 0;
  border-radius: 16px;
  box-shadow: var(--gpt-shadow-menu);
}

html body .top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

html body .top-actions .plain-btn,
html body .top-actions .outline-btn {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: none;
}

html body .top-actions .outline-btn {
  border: 1px solid var(--gpt-line);
  background: var(--gpt-surface);
  color: var(--gpt-ink);
}

html body .top-actions .outline-btn:hover {
  background: var(--gpt-bubble);
}

html body #guestActions .plain-btn {
  background: var(--gpt-ink);
  color: var(--gpt-on-ink);
}

html body #guestActions .plain-btn:hover {
  background: var(--gpt-ink-hover);
}

html body #userActions .plain-btn {
  background: transparent;
  color: var(--gpt-muted);
}

html body #userActions .plain-btn:hover {
  background: var(--gpt-bubble);
  color: var(--gpt-ink);
}

html body .api-docs-top-btn {
  border: 0 !important;
  background: transparent !important;
  color: var(--gpt-muted) !important;
}

html body .api-docs-top-btn:hover {
  background: var(--gpt-bubble) !important;
  color: var(--gpt-ink) !important;
}

html body .api-docs-top-btn svg {
  width: 16px;
  height: 16px;
}

html body .topbar .balance-pill {
  position: static;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--gpt-chip);
  color: var(--gpt-ink);
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}

html body .topbar .balance-pill:hover {
  background: var(--gpt-hover);
}

html body .topbar .balance-pill[hidden] {
  display: none;
}

/* 悬浮的 API 文档按钮会挡住顶栏，入口已在顶栏和侧栏 */
html body .developer-docs-btn {
  display: none !important;
}

@media (min-width: 861px) {
  html body .app-shell.history-pinned #logoutTopBtn {
    display: none;
  }
}

/* ---------- 消息区 ---------- */

html body .messages,
html body[data-session-type="chat"] .messages,
html body[data-session-type="image"] .messages,
html body[data-session-type="chat"] .app-shell.history-pinned .messages,
html body[data-session-type="image"] .app-shell.history-pinned .messages {
  padding: 20px max(20px, calc((100% - var(--composer)) / 2)) 32px;
}

html body .message {
  margin-bottom: 24px;
}

html body .assistant-mark,
html body[data-session-type="chat"] .chat-message.chat-assistant .assistant-mark {
  display: none;
}

html body .message.assistant,
html body[data-session-type="chat"] .chat-message.chat-assistant {
  display: block;
}

html body .message.user .message-body,
html body[data-session-type="chat"] .chat-message.chat-user .chat-bubble {
  max-width: min(70%, 560px);
  padding: 10px 18px;
  border: 0;
  border-radius: 22px;
  background: var(--gpt-bubble);
  color: var(--gpt-ink);
  box-shadow: none;
}

html body .message.user .message-body p,
html body[data-session-type="chat"] .chat-message.chat-user .chat-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.6;
  white-space: pre-wrap;
}

html body[data-session-type="chat"] .chat-message.chat-assistant .chat-bubble {
  width: 100%;
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

html body .chat-markdown {
  color: var(--gpt-ink);
  font-size: 16px;
  line-height: 1.75;
}

html body .chat-markdown p {
  margin: 0 0 14px;
}

html body .chat-markdown p:last-child {
  margin-bottom: 0;
}

html body .chat-markdown h1,
html body .chat-markdown h2,
html body .chat-markdown h3,
html body .chat-markdown h4 {
  margin: 22px 0 10px;
  font-weight: 600;
  line-height: 1.4;
}

html body .chat-markdown h1 { font-size: 24px; }
html body .chat-markdown h2 { font-size: 20px; }
html body .chat-markdown h3 { font-size: 18px; }

html body .chat-markdown ul,
html body .chat-markdown ol {
  margin: 4px 0 14px;
  padding-left: 1.5em;
}

html body .chat-markdown li {
  margin: 4px 0;
}

html body .chat-markdown strong {
  font-weight: 600;
}

html body .chat-markdown :not(pre) > code {
  padding: 0.15em 0.4em;
  border-radius: 6px;
  background: var(--gpt-hover);
  color: var(--gpt-ink);
  font-size: 0.875em;
}

html body .chat-markdown blockquote {
  margin: 0 0 14px;
  padding: 2px 0 2px 14px;
  border-left: 3px solid var(--gpt-line);
  color: var(--gpt-muted);
}

html body .chat-markdown table {
  border-collapse: collapse;
  margin: 6px 0 16px;
  font-size: 14px;
}

html body .chat-markdown th,
html body .chat-markdown td {
  padding: 8px 14px;
  border: 0;
  border-bottom: 1px solid var(--gpt-line);
  text-align: left;
}

html body .chat-markdown th {
  font-weight: 600;
}

html body .chat-markdown hr {
  margin: 20px 0;
  border: 0;
  border-top: 1px solid var(--gpt-line);
}

html body .code-block {
  margin: 8px 0 16px;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: #171717;
}

html body .code-block-head {
  min-height: 38px;
  padding: 0 14px;
  background: #2f2f2f;
  color: #cdcdcd;
  font-size: 12px;
  font-weight: 500;
}

html body .code-block-head button {
  border-radius: 8px;
  color: #cdcdcd;
  font-size: 12px;
}

html body .code-block pre {
  margin: 0;
  padding: 16px;
  background: transparent;
  font-size: 13.5px;
  line-height: 1.6;
}

html body .chat-message-actions,
html body .image-user-actions {
  gap: 2px;
  margin-top: 6px;
}

html body .chat-action-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--gpt-muted);
  box-shadow: none;
}

html body .chat-action-btn:hover {
  background: var(--gpt-bubble);
  color: var(--gpt-ink);
}

html body .chat-action-btn svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.9;
}

html body .scroll-bottom-btn {
  border: 1px solid var(--gpt-line);
  background: var(--gpt-surface);
  color: var(--gpt-ink);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

/* ---------- 生图结果 ---------- */

html body .message-meta {
  gap: 8px;
  margin-bottom: 6px;
  color: var(--gpt-faint);
  font-size: 13px;
}

html body .message-meta strong {
  color: var(--gpt-ink);
  font-size: 14px;
  font-weight: 600;
}

html body .image-assistant-message .message-body > p {
  margin: 6px 0 0;
  color: var(--gpt-ink);
  font-size: 16px;
  line-height: 1.7;
}

html body .generation-settings {
  gap: 6px;
  margin: 2px 0 6px;
}

html body .generation-settings span:not(.generation-status-dot) {
  min-height: 24px;
  padding: 0 9px;
  border: 0;
  background: var(--gpt-chip);
  color: var(--gpt-muted);
  font-size: 12px;
  font-weight: 500;
}

html body .image-grid {
  gap: 10px;
  margin-top: 12px;
}

html body .image-card {
  border: 0;
  border-radius: 18px;
  background: var(--gpt-chip);
  box-shadow: none;
  overflow: hidden;
}

html body .image-card img,
html body .image-skeleton,
html body .image-missing {
  border-radius: 18px;
}

html body .image-card img {
  background: var(--gpt-chip);
  cursor: zoom-in;
}

html body .image-skeleton {
  background: var(--gpt-chip);
}

/* 操作按钮回到图片右上角悬浮，跟 ChatGPT 生图一致 */
html body .image-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  left: auto;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 4px;
  border: 0;
  border-radius: 12px;
  background: var(--gpt-overlay);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

html body .image-card:hover .image-actions,
html body .image-card:focus-within .image-actions {
  opacity: 1;
  transform: translateY(0);
}

@media (hover: none) {
  html body .image-actions {
    opacity: 1;
    transform: none;
  }
}

html body .image-actions .icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--gpt-ink);
  box-shadow: none;
}

html body .image-actions .icon-btn:hover {
  background: var(--gpt-press);
}

html body .image-caption {
  padding: 8px 12px;
  border-top: 0;
  background: transparent;
  color: var(--gpt-faint);
  font-size: 12px;
}

html body .image-card-missing .image-caption,
html body .image-card .image-skeleton + .image-caption {
  background: transparent;
}

html body .image-result-actions {
  gap: 6px;
  margin-top: 10px;
}

html body .image-result-action {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--gpt-chip);
  color: var(--gpt-ink);
  font-size: 13px;
  font-weight: 500;
}

html body .image-result-action:hover {
  background: var(--gpt-hover);
}

/* ---------- 输入框（ChatGPT 式：上面输入，下面一排工具 + 发送） ---------- */

html body .composer-dock {
  gap: 6px;
  padding: 0 16px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, var(--gpt-bg) 22px);
}

html body .composer,
html body.has-attachments .composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "attach attach attach attach"
    "text text text text"
    "settings settings settings settings"
    "plus tools mic send";
  align-items: center;
  column-gap: 4px;
  row-gap: 4px;
  padding: 10px 10px 10px;
  border: 0;
  border-radius: var(--gpt-radius-composer);
  background: var(--gpt-surface);
  box-shadow: var(--gpt-shadow-composer);
}

html body .composer:focus-within {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1), 0 6px 22px rgba(0, 0, 0, 0.08);
}

html body .composer > .attachment-row {
  grid-area: attach;
  padding: 0 4px 4px;
}

html body .composer > .prompt-row {
  display: contents;
}

html body .composer-feature-picker {
  grid-area: plus;
  align-self: end;
}

html body .prompt-row textarea {
  grid-area: text;
  width: 100%;
  min-height: 44px;
  max-height: 40vh;
  padding: 8px 10px 4px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--gpt-ink);
  font-size: 16px;
  line-height: 1.5;
  resize: none;
}

html body .prompt-row textarea::placeholder {
  color: var(--gpt-faint);
}

html body .prompt-row textarea:focus {
  border: 0;
  box-shadow: none;
}

html body .composer #micBtn {
  grid-area: mic;
  align-self: end;
}

html body .composer #sendBtn {
  grid-area: send;
  align-self: end;
}

html body .composer > .chat-toolbar {
  grid-area: tools;
  width: auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 0;
}

html body .composer > .chat-toolbar[hidden] {
  display: none;
}

html body .composer > .settings-row {
  grid-area: settings;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 2px 4px 4px;
}

/* 纯生图对话：参数直接放在 + 号右边那一排 */
html body .composer:has(> .chat-toolbar[hidden]) > .settings-row {
  grid-area: tools;
  padding: 0;
}

html body .composer:has(> .chat-toolbar[hidden]) {
  grid-template-areas:
    "attach attach attach attach"
    "text text text text"
    "plus tools mic send";
}

html body .composer .icon-btn,
html body .composer #attachBtn,
html body .composer #micBtn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--gpt-ink);
  box-shadow: none;
}

html body .composer #attachBtn {
  border: 1px solid var(--gpt-line);
}

html body .composer .icon-btn:hover,
html body .composer #attachBtn:hover,
html body .composer #micBtn:hover {
  background: var(--gpt-bubble);
}

html body .composer .icon-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}

html body .send-btn {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--gpt-ink);
  color: var(--gpt-on-ink);
  box-shadow: none;
}

html body .send-btn:hover:not(:disabled) {
  background: var(--gpt-ink-hover);
  box-shadow: none;
  transform: none;
}

html body .send-btn:disabled {
  background: var(--gpt-disabled);
  color: var(--gpt-on-disabled);
  opacity: 1;
}

html body .send-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

/* 工具按钮：幽灵按钮，图标为主 */
html body .composer .chat-tool-toggle,
html body .composer .chat-mode-btn,
html body .composer .chat-reasoning-btn,
html body .composer .tool-pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--gpt-muted);
  font-size: 14px;
  font-weight: 500;
  box-shadow: none;
}

html body .composer .chat-tool-toggle {
  width: 36px;
  padding: 0;
  justify-content: center;
}

html body .composer .chat-tool-toggle > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

html body .composer .chat-tool-toggle:hover,
html body .composer .chat-mode-btn:hover,
html body .composer .chat-reasoning-btn:hover,
html body .composer .tool-pill:hover {
  background: var(--gpt-bubble);
  color: var(--gpt-ink);
}

html body .composer .chat-tool-toggle.is-active,
html body .composer .chat-mode-btn.is-active,
html body .composer .chat-reasoning-btn.is-active {
  background: var(--gpt-blue-soft);
  color: var(--gpt-blue);
}

html body .composer .chat-tool-toggle svg,
html body .composer .chat-mode-btn svg,
html body .composer .chat-reasoning-btn svg,
html body .composer .tool-pill svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

html body .composer .chat-mode-btn svg:last-child,
html body .composer .chat-reasoning-btn svg:last-child {
  width: 14px;
  height: 14px;
}

html body .composer .chat-mode-picker,
html body .composer .chat-reasoning-picker {
  position: relative;
}

html body .composer .chat-mode-menu,
html body .composer .chat-reasoning-menu,
html body .composer-feature-menu,
html body .model-menu,
html body .choice-menu {
  border: 0;
  border-radius: 16px;
  box-shadow: var(--gpt-shadow-menu);
}

/* 生图参数：灰色小胶囊 */
html body .composer .setting-control {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 0 2px 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--gpt-chip);
}

html body .composer .setting-control:hover {
  background: var(--gpt-hover);
}

html body .composer .setting-control > span {
  color: var(--gpt-faint);
  font-size: 13px;
  font-weight: 400;
}

html body .composer .model-menu-btn,
html body .composer .choice-btn {
  width: auto;
  max-width: 220px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px 0 4px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--gpt-ink);
  box-shadow: none;
}

html body .composer .model-menu-btn strong,
html body .composer .choice-btn strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 500;
}

html body .composer .model-menu-btn small {
  display: none;
}

html body .composer .model-menu-btn svg,
html body .composer .choice-btn svg {
  width: 14px;
  height: 14px;
  color: var(--gpt-faint);
}

html body .composer .settings-row .tool-pill {
  min-height: 36px;
  background: var(--gpt-chip);
  color: var(--gpt-ink);
  font-size: 13px;
}

html body .composer .settings-row .tool-pill:hover {
  background: var(--gpt-hover);
}

html body .cost-preview {
  color: var(--gpt-faint);
  font-size: 12px;
  font-weight: 500;
}

html body .style-drawer {
  gap: 6px;
}

html body .style-chip {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--gpt-chip);
  color: var(--gpt-ink);
  font-size: 13px;
  font-weight: 500;
}

html body .style-chip:hover {
  background: var(--gpt-hover);
}

html body .style-chip.is-active {
  border: 0;
  background: var(--gpt-ink);
  color: var(--gpt-on-ink);
}

html body .dock-note {
  margin: 2px 0 0;
  color: var(--gpt-faint);
  font-size: 12px;
  text-align: center;
}

html body .image-recovery-banner {
  border: 0;
  border-radius: 16px;
  background: var(--gpt-chip);
}

/* ---------- 空白页：标题 + 输入框居中（桌面端） ---------- */

html body .empty-state {
  gap: 14px;
}

html body .empty-state h1 {
  margin: 0;
  color: var(--gpt-ink);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0;
}

html body .empty-state p {
  max-width: 520px;
  margin: 0;
  color: var(--gpt-muted);
  font-size: 15px;
  line-height: 1.6;
}

html body .suggestion-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 760px;
  margin-top: 6px;
}

html body .suggestion-card {
  max-width: 360px;
  min-height: 0;
  padding: 9px 16px;
  border: 1px solid var(--gpt-line);
  border-radius: 999px;
  background: var(--gpt-surface);
  color: var(--gpt-muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  text-align: center;
  box-shadow: none;
}

html body .suggestion-card:hover {
  background: var(--gpt-bubble);
  color: var(--gpt-ink);
}

@media (min-width: 861px) {
  html body .workspace:has(> .messages > .empty-state) {
    grid-template-rows: 56px minmax(0, 1fr) auto minmax(0, 1.15fr);
  }

  html body .workspace:has(> .messages > .empty-state) > .messages {
    align-self: end;
    overflow: visible;
    padding-bottom: 26px;
  }

  html body .workspace:has(> .messages > .empty-state) .empty-state {
    min-height: 0;
    padding-bottom: 0;
  }

  html body .workspace:has(> .messages > .empty-state) .composer-dock {
    align-self: start;
    background: transparent;
  }

  html body .workspace:has(> .messages > .empty-state) .dock-note {
    visibility: hidden;
  }
}

/* ---------- 弹窗 / 菜单统一圆角 ---------- */

html body .auth-card {
  border: 0;
  border-radius: 24px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 24px 64px rgba(0, 0, 0, 0.16);
}

html body .auth-card .primary-btn {
  border-radius: 999px;
  background: var(--gpt-ink);
}

html body .auth-card .field input {
  border-radius: 12px;
}

/* ---------- 手机端 ---------- */

@media (max-width: 860px) {
  html body .workspace,
  html body .app-shell:not(.is-guest) .workspace {
    grid-template-rows: 52px minmax(0, 1fr) auto;
  }

  html body .app-shell:not(.is-guest) .workspace > .topbar,
  html body .workspace > .topbar {
    min-height: 52px;
    padding: env(safe-area-inset-top) 8px 0 6px;
  }

  html body .mobile-menu {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--gpt-ink);
  }

  html body .topbar .chat-model-btn,
  html body .brand-name {
    font-size: 17px;
  }

  html body .api-docs-top-btn span {
    display: none;
  }

  html body .messages,
  html body[data-session-type="chat"] .messages,
  html body[data-session-type="image"] .messages {
    padding: 12px 14px 20px;
  }

  html body .message.user .message-body,
  html body[data-session-type="chat"] .chat-message.chat-user .chat-bubble {
    max-width: 85%;
  }

  html body .composer-dock {
    padding: 0 10px calc(8px + env(safe-area-inset-bottom));
  }

  html body .composer {
    border-radius: 24px;
  }

  html body .history-panel {
    width: min(300px, 86vw);
    inset: 0 auto 0 0;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
  }

  html body .conversation-actions {
    opacity: 1;
    pointer-events: auto;
    position: static;
    transform: none;
    background: transparent;
    padding-left: 0;
  }

  html body .conversation-item.is-active .conversation-actions {
    background: transparent;
  }

  html body .conversation-actions .conversation-mini {
    display: none;
  }
}

/* ---------- 生图网格：多张两列，单张限制尺寸 ---------- */

html body .image-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
  justify-content: stretch;
}

html body .image-grid:has(> .image-card:only-child) {
  grid-template-columns: minmax(0, min(var(--image-card-max, 520px), 520px));
}

html body .image-grid > .image-card {
  width: 100%;
  max-width: 100%;
}

html body[data-session-type="chat"] .chat-markdown table {
  border: 0;
  border-radius: 0;
  overflow: visible;
}

html body[data-session-type="chat"] .chat-markdown th,
html body[data-session-type="chat"] .chat-markdown td {
  border: 0;
  border-bottom: 1px solid var(--gpt-line);
  background: transparent;
}

html body .composer .prompt-row textarea {
  min-height: 40px;
  padding: 8px 10px;
  line-height: 24px;
}

/* 空白页建议：聊天用胶囊，生图提示较长用两列卡片 */
html body .empty-state .suggestion-grid {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  grid-template-columns: none;
  width: min(760px, 100%);
}

html body[data-session-type="image"] .empty-state .suggestion-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(720px, 100%);
}

html body[data-session-type="image"] .empty-state .suggestion-card {
  max-width: none;
  padding: 12px 16px;
  border-radius: 16px;
  text-align: left;
}

@media (min-width: 861px) {
  html body .workspace:has(> .messages > .empty-state) {
    grid-template-rows: 56px minmax(max-content, 1fr) auto minmax(0, 1.15fr);
  }
}

@media (max-width: 520px) {
  html body[data-session-type="image"] .empty-state .suggestion-grid {
    grid-template-columns: 1fr;
  }
}

/* 空白页输入框在屏幕中间，上方空间不够，下拉菜单改为向下展开 */
@media (min-width: 861px) {
  html body .workspace:has(> .messages > .empty-state) .composer .choice-menu,
  html body .workspace:has(> .messages > .empty-state) .composer .model-menu,
  html body .workspace:has(> .messages > .empty-state) .composer .chat-mode-menu,
  html body .workspace:has(> .messages > .empty-state) .composer .chat-reasoning-menu,
  html body .workspace:has(> .messages > .empty-state) .composer .composer-feature-menu {
    top: calc(100% + 8px);
    bottom: auto;
    max-height: min(420px, 38vh);
    overflow-y: auto;
  }
}

/* ---------- 手机端：顶栏常驻（菜单 / 标题 / 余额），生图参数单独一行两列 ---------- */
@media (max-width: 860px) {
  html body .app-shell:not(.is-guest) .workspace,
  html body .workspace {
    grid-template-rows: calc(52px + env(safe-area-inset-top)) minmax(0, 1fr) auto;
  }

  html body .app-shell:not(.is-guest) .workspace > .topbar {
    position: relative;
    inset: auto;
    width: auto;
    display: flex;
    min-height: calc(52px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 8px 0 6px;
    background: var(--gpt-bg);
    box-shadow: none;
  }

  html body .app-shell:not(.is-guest) .workspace > .topbar .brand-name {
    display: inline-flex;
  }

  html body[data-session-type="chat"] .app-shell:not(.is-guest) .workspace > .topbar .brand-name {
    display: none;
  }

  html body .app-shell:not(.is-guest) .workspace > .topbar .top-actions {
    display: flex;
  }

  html body .app-shell:not(.is-guest) .workspace > .topbar .top-actions.is-hidden {
    display: none;
  }

  html body .app-shell:not(.is-guest) .workspace > .topbar .mobile-menu {
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  html body #userActions .api-docs-top-btn,
  html body #userActions .mobile-account {
    display: none;
  }

  html body .topbar .chat-model-menu {
    min-width: min(300px, calc(100vw - 24px));
  }

  html body .composer,
  html body .composer:has(> .chat-toolbar[hidden]) {
    grid-template-areas:
      "attach attach attach attach"
      "text text text text"
      "settings settings settings settings"
      "plus tools mic send";
  }

  html body .composer > .settings-row,
  html body .composer:has(> .chat-toolbar[hidden]) > .settings-row,
  html body[data-session-type="image"] .composer > .settings-row {
    grid-area: settings;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 0 2px 4px;
  }

  html body .composer > .settings-row[hidden] {
    display: none !important;
  }

  html body .composer .settings-row .model-control {
    grid-column: 1 / -1;
  }

  html body .composer .setting-control,
  html body .composer .settings-row .tool-pill {
    width: 100%;
    min-width: 0;
  }

  html body .composer .setting-control {
    justify-content: space-between;
  }

  html body .composer .settings-row .tool-pill {
    justify-content: center;
  }

  html body .composer .model-menu-btn,
  html body[data-session-type="image"] .composer .model-menu-btn {
    width: auto;
    max-width: calc(100% - 44px);
  }

  /* 不能用横向滚动：会把向上弹出的菜单裁掉 */
  html body .composer > .chat-toolbar {
    flex-wrap: wrap;
  }

  html body .composer .chat-mode-btn span,
  html body .composer .chat-reasoning-btn span {
    white-space: nowrap;
  }
}

/* 手机端聊天工具：单独一行；文件库 / 项目 / 提醒在 + 菜单里已有，这里隐藏 */
@media (max-width: 860px) {
  html body .composer:has(> .chat-toolbar:not([hidden])) {
    grid-template-areas:
      "attach attach attach attach"
      "text text text text"
      "settings settings settings settings"
      "tools tools tools tools"
      "plus . mic send";
  }

  html body .composer > .chat-toolbar {
    padding: 0 2px;
  }

  html body .composer #chatFilesBtn,
  html body .composer #chatProjectBtn,
  html body .composer #chatTasksBtn {
    display: none;
  }
}

@media (max-width: 860px) {
  html body .composer .chat-tool-toggle {
    width: 32px;
    min-height: 32px;
  }

  html body .composer .chat-mode-btn,
  html body .composer .chat-reasoning-btn {
    min-height: 32px;
    gap: 4px;
    padding: 0 8px;
    font-size: 13px;
  }
}

/* 窄屏：思考强度只留图标（非默认时按钮变蓝），保证工具一行放得下 */
@media (max-width: 520px) {
  html body .composer #chatReasoningLabel {
    display: none;
  }
}

@media (max-width: 860px) {
  html body .composer > .chat-toolbar > .chat-tool-toggle {
    flex: 0 0 32px;
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    padding: 0;
  }
}

/* ======================= v2（2026-11-06）======================= */

/* ---------- 登录弹窗：ChatGPT 式居中卡片 ---------- */

html body .auth-gate {
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

html body .auth-card {
  width: min(400px, 100%);
  gap: 14px;
  padding: 36px 32px 26px;
  border: 0;
  border-radius: 24px;
  scrollbar-gutter: auto;
  scrollbar-width: thin;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
}

html body .auth-card .auth-mark {
  justify-self: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--gpt-ink);
}

html body #loginForm .auth-mark img {
  width: 48px;
  height: 48px;
  display: block;
}

html body .auth-2fa .auth-mark {
  background: var(--gpt-chip);
  color: var(--gpt-ink);
}

html body .auth-2fa .auth-mark svg {
  color: var(--gpt-ink);
}

html body .auth-card .eyebrow {
  display: none;
}

html body .auth-card h1 {
  margin: 2px 0 0;
  color: var(--gpt-ink);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
}

html body .auth-card .auth-copy {
  margin: -4px 0 6px;
  color: var(--gpt-muted);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}

html body .auth-card .field {
  gap: 6px;
  color: var(--gpt-ink);
  font-size: 13px;
  font-weight: 500;
}

html body .auth-card .field-optional {
  margin-left: 4px;
  color: var(--gpt-faint);
  font-size: 12px;
  font-weight: 400;
}

html body .auth-card .field input {
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--gpt-input-border);
  border-radius: 12px;
  background: var(--gpt-surface);
  color: var(--gpt-ink);
  font-size: 15px;
  font-weight: 400;
  box-shadow: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

html body .auth-card .field input:focus {
  border-color: var(--gpt-ink);
  box-shadow: 0 0 0 3px rgba(13, 13, 13, 0.08);
}

html body .auth-card .field input::placeholder {
  color: var(--gpt-faint);
  font-weight: 400;
}

/* 2FA 输入框：打字时等宽加字距，占位文字保持正常大小 */
html body #loginTotpCode,
html body #twoFactorCode {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.24em;
}

html body #loginTotpCode::placeholder,
html body #twoFactorCode::placeholder {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
}

html body .auth-card .captcha-field {
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 8px;
}

html body .auth-card .captcha-image-btn {
  height: 48px;
  grid-template-columns: minmax(0, 1fr) 44px;
  border: 1px solid var(--gpt-input-border);
  border-radius: 12px;
}

html body .auth-card .captcha-image-btn span {
  border-left: 1px solid var(--gpt-line);
  background: var(--gpt-chip);
  color: var(--gpt-ink);
  font-size: 12px;
  font-weight: 500;
}

html body .auth-card .captcha-image-btn:hover span {
  background: var(--gpt-hover);
}

/* 只读的连接信息对用户没用，收起不占位置 */
html body .auth-card .endpoint-details {
  display: none;
}

html body .auth-card .primary-btn {
  min-height: 50px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--gpt-ink);
  color: var(--gpt-on-ink);
  font-size: 15px;
  font-weight: 600;
  box-shadow: none;
}

html body .auth-card .primary-btn:hover:not(:disabled) {
  background: var(--gpt-ink-hover);
}

html body .auth-card .fine-print {
  margin: 0;
  color: var(--gpt-faint);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

html body .auth-card .auth-error {
  margin: 0;
  border: 0;
  border-radius: 12px;
  background: var(--gpt-error-bg);
  font-weight: 500;
}

html body .auth-close {
  top: 14px;
  right: 14px;
  color: var(--gpt-muted);
}

html body .auth-back {
  top: 14px;
  left: 14px;
  font-weight: 500;
}

@media (max-width: 520px) {
  html body .auth-gate {
    padding: 12px;
  }

  html body .auth-card {
    padding: 30px 20px 22px;
  }

  html body .auth-card .captcha-field {
    grid-template-columns: minmax(0, 1fr) 136px;
  }
}

/* ---------- 侧边栏细节 ---------- */

/* 悬停操作按钮：覆盖原来的 110px 固定宽度和 hover transform，竖直居中不压字 */
html body .conversation-item .conversation-actions,
html body .conversation-item:hover .conversation-actions,
html body .conversation-item.is-active .conversation-actions,
html body .conversation-item:focus-within .conversation-actions {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: auto;
  min-width: 0;
  height: auto;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 4px 0 22px;
  border: 0;
  border-radius: 0 10px 10px 0;
  box-shadow: none;
  transform: none;
}

html body .conversation-item .conversation-actions {
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--gpt-hover) 20px);
}

html body .conversation-item:hover .conversation-actions,
html body .conversation-item:focus-within .conversation-actions {
  opacity: 1;
  pointer-events: auto;
}

html body .conversation-item.is-active .conversation-actions {
  background: linear-gradient(90deg, transparent, var(--gpt-active) 20px);
}

html body .conversation-item.is-active:not(:hover):not(:focus-within) .conversation-actions {
  opacity: 0;
  pointer-events: none;
}

/* 筛选 + 导入导出合成一行，不再换行占三行 */
html body .history-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 4px;
  row-gap: 2px;
}

html body .history-tools > .history-search {
  grid-column: 1 / -1;
}

html body .history-tools > .history-filters {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 4px;
}

html body .history-tools > .history-filters::-webkit-scrollbar {
  display: none;
}

html body .history-filter {
  flex: 0 0 auto;
  white-space: nowrap;
}

html body .history-tools > .history-pack-actions {
  flex-wrap: nowrap;
  gap: 0;
  padding: 0;
}

html body .history-pack-actions .history-mini-btn {
  width: 28px;
  padding: 0;
  justify-content: center;
}

html body .history-pack-actions .history-mini-btn span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* 未登录时左下角是“未登录”行，弱化成一个登录入口 */
html body .app-shell.is-guest .history-foot .balance-card {
  display: none;
}

/* ---------- 生图结果细节 ---------- */

html body .image-assistant-message .message-meta {
  flex-wrap: wrap;
  row-gap: 2px;
}

html body .image-assistant-message .message-meta span {
  white-space: nowrap;
}

html body .image-card .image-caption {
  padding: 8px 12px 10px;
  line-height: 1.5;
}

/* 原来的气泡化 hover 操作按钮，统一成幽灵按钮 */
html body .image-user-actions {
  opacity: 0;
  transition: opacity 0.12s ease;
}

html body .message.user:hover .image-user-actions,
html body .message.user:focus-within .image-user-actions {
  opacity: 1;
}

@media (hover: none) {
  html body .image-user-actions {
    opacity: 1;
  }
}

html body #loginTotpCode {
  text-align: left;
}

html body .auth-link-btn {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gpt-ink);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ======================= v3（2026-11-06）======================= */

/* 1. 屏幕矮时列表不压缩分组标题和对话行 */
html body .conversation-list > * {
  flex-shrink: 0;
}

/* 2. 生图结果：一行简要信息 + 折叠的「生成详情」 */
html body .generation-brief {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 4px;
  color: var(--gpt-faint);
  font-size: 13px;
}

html body .generation-brief .generation-status-dot {
  width: 7px;
  height: 7px;
  box-shadow: none;
}

html body .generation-brief-status {
  color: var(--gpt-muted);
  font-weight: 500;
}

html body .generation-brief-status[data-status="failed"] {
  color: #d03a2f;
}

html body .generation-details {
  margin-top: 8px;
  color: var(--gpt-faint);
  font-size: 12px;
}

html body .generation-details > summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 8px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

html body .generation-details > summary::-webkit-details-marker {
  display: none;
}

html body .generation-details > summary::after {
  content: "›";
  font-size: 14px;
  line-height: 1;
  transition: transform 0.15s ease;
}

html body .generation-details[open] > summary::after {
  transform: rotate(90deg);
}

html body .generation-details > summary:hover {
  background: var(--gpt-bubble);
  color: var(--gpt-ink);
}

html body .generation-details[open] {
  padding: 8px 10px 4px;
  border-radius: 12px;
  background: var(--gpt-sidebar);
}

html body .generation-details[open] > summary {
  margin: -4px 0 6px -6px;
}

html body .generation-details .message-meta {
  flex-wrap: wrap;
  margin-bottom: 6px;
  font-size: 12px;
}

html body .generation-details .message-meta strong {
  font-size: 12px;
}

html body .image-assistant-message .image-result-actions {
  margin-top: 10px;
}

/* 3. 生成中：柔和流动的渐变占位，代替灰块 */
html body .image-skeleton {
  background: linear-gradient(120deg, #eef0f3, #f7f4ef, #eef3f1, #f3eef6, #eef0f3);
  background-size: 400% 400%;
  animation: gpt-image-pending 6s ease-in-out infinite;
  filter: saturate(1.05);
}

html body .image-skeleton::after {
  background: linear-gradient(90deg, transparent, var(--gpt-shimmer), transparent);
}

html body .image-card:has(.image-skeleton) .image-caption {
  color: var(--gpt-muted);
  font-size: 13px;
}

@keyframes gpt-image-pending {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@media (prefers-reduced-motion: reduce) {
  html body .image-skeleton {
    animation: none;
  }
}

/* 4. 生图模型选择器在顶栏左上角（和聊天一致），比例/质量/数量留在输入框 */
html body .topbar .model-control {
  position: relative;
  display: none;
  min-height: 40px;
  padding: 0;
  border-radius: 10px;
  background: transparent;
}

html body[data-session-type="image"] .app-shell:not(.is-guest) .topbar .model-control,
html body[data-session-type="image"] .app-shell.has-image-access .topbar .model-control,
html body[data-session-type="chat"] .app-shell:not(.is-guest) .topbar .model-control:has(.model-menu-btn:not([hidden])) {
  display: inline-flex;
}

html body[data-session-type="image"] .app-shell:not(.is-guest) .topbar .brand-name {
  display: none;
}

html body .topbar .model-control > span {
  display: none;
}

html body .topbar .model-control .model-menu-btn {
  width: auto;
  max-width: min(360px, 50vw);
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--gpt-ink);
  box-shadow: none;
}

html body .topbar .model-control .model-menu-btn[hidden] {
  display: none;
}

html body .topbar .model-control .model-menu-btn:hover,
html body .topbar .model-control .model-menu-btn[aria-expanded="true"] {
  background: var(--gpt-bubble);
}

html body .topbar .model-control .model-menu-btn strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 18px;
  font-weight: 500;
}

html body .topbar .model-control .model-menu-btn small {
  display: none;
}

html body .topbar .model-control .model-menu-btn svg {
  width: 16px;
  height: 16px;
  color: var(--gpt-faint);
  transform: rotate(180deg);
}

html body .topbar .model-menu {
  top: calc(100% + 6px);
  bottom: auto;
  left: 0;
  max-height: min(480px, calc(100dvh - 90px));
  border: 0;
  border-radius: 16px;
  box-shadow: var(--gpt-shadow-menu);
}

html body .composer .settings-row .tool-pill {
  width: 36px;
  min-width: 36px;
  padding: 0;
  justify-content: center;
  font-size: 0;
}

html body .composer .settings-row .tool-pill svg {
  width: 18px;
  height: 18px;
}

/* 5. 顶栏「…」菜单 */
html body .top-more {
  position: relative;
  display: none;
}

html body[data-session-type="chat"] .top-more {
  display: block;
}

html body .top-more-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--gpt-muted);
}

html body .top-more-btn:hover,
html body .top-more-btn[aria-expanded="true"] {
  background: var(--gpt-bubble);
  color: var(--gpt-ink);
}

html body .top-more-btn svg {
  width: 20px;
  height: 20px;
}

html body .top-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: var(--z-dropdown);
  min-width: 200px;
  display: grid;
  gap: 2px;
  padding: 6px;
  border-radius: 16px;
  background: var(--gpt-surface);
  box-shadow: var(--gpt-shadow-menu);
}

html body .top-more-menu[hidden] {
  display: none;
}

html body .top-more-menu .top-more-item {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--gpt-ink);
  font-size: 14px;
  font-weight: 400;
  text-align: left;
  box-shadow: none;
}

html body .top-more-menu .top-more-item:hover {
  background: var(--gpt-bubble);
}

html body .top-more-menu .top-more-item svg {
  width: 18px;
  height: 18px;
  color: var(--gpt-muted);
}

html body .top-more-menu .top-more-item.is-active svg {
  color: var(--gpt-blue);
}

html body .top-more-menu .top-more-item.is-active::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-radius: 999px;
  background: var(--gpt-blue);
}

/* 6. 自己消息的 编辑/重试/删除 放到气泡下方（右对齐），桌面悬停显示 */
html body .message.user,
html body[data-session-type="chat"] .chat-message.chat-user {
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 2px;
}

html body .message.user > .message-body {
  order: 1;
}

html body .message.user > .image-user-actions,
html body .message.user > .chat-user-actions {
  order: 2;
  display: flex;
  justify-content: flex-end;
  gap: 0;
  margin: 0;
}

html body .message.user > .chat-user-actions {
  opacity: 0;
  transition: opacity 0.12s ease;
}

html body .message.user:hover > .chat-user-actions,
html body .message.user:focus-within > .chat-user-actions {
  opacity: 1;
}

@media (hover: none) {
  html body .message.user > .chat-user-actions,
  html body .message.user > .image-user-actions {
    opacity: 1;
  }

  html body .message.user .chat-action-btn {
    width: 30px;
    height: 30px;
  }
}

@media (max-width: 860px) {
  html body .topbar .model-control .model-menu-btn strong {
    font-size: 16px;
  }

  html body .topbar .model-control .model-menu-btn {
    max-width: 52vw;
  }

  html body .topbar .model-menu {
    width: min(338px, calc(100vw - 20px));
  }

  /* 工具少了，思考强度的文字可以放回来 */
  html body .composer #chatReasoningLabel {
    display: inline;
  }
}

/* 7. 图片库 */
html body .image-library {
  position: fixed;
  inset: 0;
  z-index: var(--z-session-modal);
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

html body .image-library[hidden] {
  display: none;
}

html body .image-library-panel {
  width: min(1180px, 100%);
  height: min(860px, 100%);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  background: var(--gpt-bg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
}

html body .image-library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px 24px;
}

html body .image-library-head h2 {
  margin: 0;
  color: var(--gpt-ink);
  font-size: 20px;
  font-weight: 600;
}

html body .image-library-head p {
  margin: 2px 0 0;
  color: var(--gpt-faint);
  font-size: 13px;
}

html body .image-library-head .icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--gpt-muted);
}

html body .image-library-head .icon-btn:hover {
  background: var(--gpt-bubble);
  color: var(--gpt-ink);
}

html body .image-library-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 24px 24px;
  columns: 4 220px;
  column-gap: 10px;
}

html body .image-library-tile {
  position: relative;
  margin: 0 0 10px;
  overflow: hidden;
  break-inside: avoid;
  border-radius: 14px;
  background: var(--gpt-chip);
}

html body .image-library-tile img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
}

html body .image-library-tile figcaption {
  position: absolute;
  inset: auto 0 0;
  max-height: 60%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  padding: 26px 12px 10px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.62));
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

html body .image-library-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: var(--gpt-overlay);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  opacity: 0;
  transition: opacity 0.15s ease;
}

html body .image-library-actions .icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--gpt-ink);
}

html body .image-library-actions .icon-btn:hover {
  background: var(--gpt-press);
}

html body .image-library-actions svg {
  width: 16px;
  height: 16px;
}

html body .image-library-tile:hover figcaption,
html body .image-library-tile:hover .image-library-actions,
html body .image-library-tile:focus-within .image-library-actions {
  opacity: 1;
}

@media (hover: none) {
  html body .image-library-actions {
    opacity: 1;
  }
}

html body .image-library-empty {
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 80px 20px;
  color: var(--gpt-faint);
  text-align: center;
  column-span: all;
}

html body .image-library-empty svg {
  width: 36px;
  height: 36px;
}

@media (max-width: 860px) {
  html body .image-library {
    padding: 0;
  }

  html body .image-library-panel {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  html body .image-library-head {
    padding: calc(12px + env(safe-area-inset-top)) 12px 8px 16px;
  }

  html body .image-library-grid {
    padding: 4px 12px calc(16px + env(safe-area-inset-bottom));
    columns: 2 140px;
    column-gap: 8px;
  }

  html body #logoutTopBtn {
    display: none;
  }
}

/* 8. 深色模式（ChatGPT 深色配色）。theme.js 把「跟随系统」解析成 data-resolved-theme */
:root[data-resolved-theme="dark"] {
  color-scheme: dark;
  --gpt-bg: #212121;
  --gpt-sidebar: #181818;
  --gpt-hover: #2a2a2a;
  --gpt-active: #303030;
  --gpt-ink: #ececec;
  --gpt-muted: #b4b4b4;
  --gpt-faint: #8f8f8f;
  --gpt-line: rgba(255, 255, 255, 0.1);
  --gpt-bubble: #303030;
  --gpt-chip: #2f2f2f;
  --gpt-blue: #48aaff;
  --gpt-blue-soft: rgba(72, 170, 255, 0.16);
  --gpt-surface: #303030;
  --gpt-on-ink: #0d0d0d;
  --gpt-ink-hover: #d0d0d0;
  --gpt-disabled: #4a4a4a;
  --gpt-on-disabled: #8f8f8f;
  --gpt-overlay: rgba(40, 40, 40, 0.9);
  --gpt-press: rgba(255, 255, 255, 0.08);
  --gpt-input-border: #424242;
  --gpt-error-bg: rgba(208, 58, 47, 0.18);
  --gpt-shimmer: rgba(255, 255, 255, 0.06);
  --gpt-shadow-composer: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 4px 18px rgba(0, 0, 0, 0.3);
  --gpt-shadow-menu: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 12px 32px rgba(0, 0, 0, 0.5);
  /* 旧样式表的变量 */
  --bg: #212121;
  --surface: #303030;
  --surface-soft: #2a2a2a;
  --surface-hover: #383838;
  --surface-active: #3a3a3a;
  --ink: #ececec;
  --ink-soft: #b4b4b4;
  --muted: #b4b4b4;
  --faint: #8f8f8f;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.16);
  --rail-bg: #181818;
  --accent-soft: rgba(16, 163, 127, 0.16);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.5);
}

html[data-resolved-theme="dark"] body,
html[data-resolved-theme="dark"] body .workspace,
html[data-resolved-theme="dark"] body .messages,
html[data-resolved-theme="dark"] body[data-session-type="chat"] .workspace,
html[data-resolved-theme="dark"] body[data-session-type="chat"] .messages,
html[data-resolved-theme="dark"] body .app-shell {
  background: var(--gpt-bg);
  color: var(--gpt-ink);
}

html[data-resolved-theme="dark"] body .composer-dock,
html[data-resolved-theme="dark"] body[data-session-type="chat"] .composer-dock,
html[data-resolved-theme="dark"] body[data-session-type="image"] .composer-dock {
  background: linear-gradient(180deg, transparent, var(--gpt-bg) 22px);
}

html[data-resolved-theme="dark"] body .composer,
html[data-resolved-theme="dark"] body[data-session-type="chat"] .composer,
html[data-resolved-theme="dark"] body .history-search:focus-within {
  background: var(--gpt-surface);
}

html[data-resolved-theme="dark"] body .history-panel,
html[data-resolved-theme="dark"] body .app-shell.history-pinned .history-panel,
html[data-resolved-theme="dark"] body .rail {
  background: var(--gpt-sidebar);
}

html[data-resolved-theme="dark"] body .topbar,
html[data-resolved-theme="dark"] body .workspace > .topbar,
html[data-resolved-theme="dark"] body .app-shell:not(.is-guest) .workspace > .topbar {
  background: var(--gpt-bg);
}

html[data-resolved-theme="dark"] body input,
html[data-resolved-theme="dark"] body select,
html[data-resolved-theme="dark"] body textarea {
  background-color: transparent;
  color: var(--gpt-ink);
}

html[data-resolved-theme="dark"] body .auth-card .field input,
html[data-resolved-theme="dark"] body .settings-textarea,
html[data-resolved-theme="dark"] body .canvas-editor {
  border-color: var(--gpt-input-border);
  background: var(--gpt-bg);
}

/* 菜单、弹窗、卡片 */
html[data-resolved-theme="dark"] body .model-menu,
html[data-resolved-theme="dark"] body .choice-menu,
html[data-resolved-theme="dark"] body .composer-feature-menu,
html[data-resolved-theme="dark"] body .image-key-menu,
html[data-resolved-theme="dark"] body .chat-model-menu,
html[data-resolved-theme="dark"] body .chat-mode-menu,
html[data-resolved-theme="dark"] body .chat-reasoning-menu,
html[data-resolved-theme="dark"] body .top-more-menu,
html[data-resolved-theme="dark"] body .auth-card,
html[data-resolved-theme="dark"] body .session-settings-card,
html[data-resolved-theme="dark"] body .prompt-assist-card,
html[data-resolved-theme="dark"] body .project-memory-card,
html[data-resolved-theme="dark"] body .asset-library-card,
html[data-resolved-theme="dark"] body .task-card,
html[data-resolved-theme="dark"] body .canvas-panel {
  border-color: var(--gpt-line);
  background: var(--gpt-surface);
  color: var(--gpt-ink);
}

html[data-resolved-theme="dark"] body .image-library-panel {
  background: var(--gpt-bg);
}

html[data-resolved-theme="dark"] body .auth-gate,
html[data-resolved-theme="dark"] body .image-library,
html[data-resolved-theme="dark"] body .history-backdrop.is-open {
  background: rgba(0, 0, 0, 0.6);
}

html[data-resolved-theme="dark"] body .feature-option:hover,
html[data-resolved-theme="dark"] body .feature-option.is-active {
  background: var(--gpt-hover);
}

html[data-resolved-theme="dark"] body .toast {
  background: #ececec;
  color: #0d0d0d;
}

/* 消息 */
html[data-resolved-theme="dark"] body .message.user .message-body,
html[data-resolved-theme="dark"] body[data-session-type="chat"] .chat-message.chat-user .chat-bubble {
  background: var(--gpt-bubble);
  color: var(--gpt-ink);
}

html[data-resolved-theme="dark"] body .chat-markdown :not(pre) > code,
html[data-resolved-theme="dark"] body[data-session-type="chat"] .chat-markdown :not(pre) > code {
  background: #424242;
  color: var(--gpt-ink);
}

html[data-resolved-theme="dark"] body[data-session-type="chat"] .chat-markdown th,
html[data-resolved-theme="dark"] body[data-session-type="chat"] .chat-markdown td {
  background: transparent;
  color: var(--gpt-ink);
}

html[data-resolved-theme="dark"] body .chat-file-attachment,
html[data-resolved-theme="dark"] body[data-session-type="chat"] .chat-file-attachment,
html[data-resolved-theme="dark"] body .chat-file-icon,
html[data-resolved-theme="dark"] body .attachment-file-icon {
  border-color: var(--gpt-line);
  background: var(--gpt-chip);
  color: var(--gpt-ink);
}

html[data-resolved-theme="dark"] body .image-caption,
html[data-resolved-theme="dark"] body .image-card .image-caption {
  background: transparent;
  color: var(--gpt-faint);
}

html[data-resolved-theme="dark"] body .image-skeleton {
  background: linear-gradient(120deg, #2a2a2a, #33302c, #2b302e, #312c34, #2a2a2a);
  background-size: 400% 400%;
}

html[data-resolved-theme="dark"] body .image-actions .icon-btn,
html[data-resolved-theme="dark"] body .image-library-actions .icon-btn {
  color: var(--gpt-ink);
}

html[data-resolved-theme="dark"] body .code-block {
  background: #171717;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* 顶栏与侧栏按钮 */
html[data-resolved-theme="dark"] body .top-actions .outline-btn {
  border-color: var(--gpt-input-border);
}

html[data-resolved-theme="dark"] body .conversation-mini[data-tooltip]::after,
html[data-resolved-theme="dark"] body .conversation-delete[data-tooltip]::after {
  background: #ececec;
  color: #0d0d0d;
}

html[data-resolved-theme="dark"] body .scroll-bottom-btn {
  border-color: var(--gpt-line);
  background: var(--gpt-surface);
  color: var(--gpt-ink);
}

html[data-resolved-theme="dark"] body .suggestion-card {
  border-color: var(--gpt-line);
}

html[data-resolved-theme="dark"] body .style-chip.is-active {
  background: var(--gpt-ink);
  color: var(--gpt-on-ink);
}

/* 验证码图片本身是白底，保留白底保证可读 */
html[data-resolved-theme="dark"] body .captcha-image-btn img {
  background: #ffffff;
}

html[data-resolved-theme="dark"] body .theme-icon-slot svg,
html[data-resolved-theme="dark"] body .new-chat-wide svg,
html[data-resolved-theme="dark"] body .sidebar-api-docs-btn svg {
  color: var(--gpt-ink);
}

html body .theme-icon-slot {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
}

html body .theme-icon-slot svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

/* 旧样式里聊天模式专用规则（body[data-session-type="chat"] ...）权重更高，这里同等前缀再覆盖一次，浅色/深色都走变量 */
html body[data-session-type] .composer {
  border: 0;
  background: var(--gpt-surface);
  box-shadow: var(--gpt-shadow-composer);
}

html body[data-session-type] .composer:focus-within {
  box-shadow: 0 0 0 1px var(--gpt-input-border), 0 6px 22px rgba(0, 0, 0, 0.08);
}

html body[data-session-type] .chat-markdown,
html body[data-session-type] .chat-markdown p,
html body[data-session-type] .chat-markdown li,
html body[data-session-type] .chat-markdown h1,
html body[data-session-type] .chat-markdown h2,
html body[data-session-type] .chat-markdown h3,
html body[data-session-type] .chat-markdown h4,
html body[data-session-type] .chat-markdown strong,
html body[data-session-type] .chat-file-text small,
html body[data-session-type] .prompt-row textarea {
  color: var(--gpt-ink);
}

html body[data-session-type] .chat-markdown :not(pre) > code {
  background: var(--gpt-hover);
  color: var(--gpt-ink);
}

html[data-resolved-theme="dark"] body[data-session-type] .chat-markdown :not(pre) > code {
  background: #424242;
}

html body[data-session-type] .chat-user-actions .chat-action-btn:hover {
  background: var(--gpt-bubble);
  color: var(--gpt-ink);
}

html body[data-session-type] .composer .chat-tool-toggle,
html body[data-session-type] .composer .chat-mode-btn,
html body[data-session-type] .composer .chat-reasoning-btn {
  border: 0;
  background: transparent;
  color: var(--gpt-muted);
}

html body[data-session-type] .composer .chat-tool-toggle:hover,
html body[data-session-type] .composer .chat-mode-btn:hover,
html body[data-session-type] .composer .chat-reasoning-btn:hover {
  background: var(--gpt-bubble);
  color: var(--gpt-ink);
}

html body[data-session-type] .composer .chat-tool-toggle.is-active,
html body[data-session-type] .composer .chat-mode-btn.is-active,
html body[data-session-type] .composer .chat-reasoning-btn.is-active {
  border: 0;
  background: var(--gpt-blue-soft);
  color: var(--gpt-blue);
}

html body[data-session-type] .topbar .chat-model-btn {
  border: 0;
  background: transparent;
  color: var(--gpt-ink);
}

html body[data-session-type] .topbar .chat-model-btn:hover,
html body[data-session-type] .topbar .chat-model-btn[aria-expanded="true"] {
  background: var(--gpt-bubble);
}

html body[data-session-type] .top-more-menu .top-more-item {
  border: 0;
  background: transparent;
  color: var(--gpt-ink);
}

html body[data-session-type] .top-more-menu .top-more-item:hover {
  background: var(--gpt-bubble);
}

html body[data-session-type] .chat-message.chat-user .chat-text,
html body[data-session-type] .message.user .message-body p {
  color: var(--gpt-ink);
}

html body[data-session-type] .dock-note {
  color: var(--gpt-faint);
}

html[data-resolved-theme="dark"] body .generation-brief-status[data-status="failed"],
html[data-resolved-theme="dark"] body .chat-model-empty.is-error,
html[data-resolved-theme="dark"] body .auth-card .auth-error {
  color: #ff8a80;
}

/* 手机：生图参数一行排开（比例 / 质量 / 数量 + 两个图标），去掉小标签省空间 */
@media (max-width: 860px) {
  html body .composer > .settings-row,
  html body .composer:has(> .chat-toolbar[hidden]) > .settings-row,
  html body[data-session-type="image"] .composer > .settings-row {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }

  html body .composer .setting-control,
  html body[data-session-type="image"] .composer .setting-control {
    width: auto;
    flex: 0 0 auto;
    padding: 0 2px 0 4px;
  }

  html body .composer .setting-control > span {
    display: none;
  }

  html body .composer .settings-row .tool-pill,
  html body[data-session-type="image"] .composer .settings-row .tool-pill {
    width: 36px;
    flex: 0 0 36px;
  }
}

@media (max-width: 860px) {
  html body[data-session-type] .composer .setting-control {
    min-width: 0;
    max-width: none;
  }

  html body[data-session-type] .composer .choice-btn {
    width: auto;
    min-width: 0;
    padding: 0 8px 0 6px;
  }
}

/* 热修复 v3.1：旧手机样式把 .model-menu 设成 position: fixed（贴着输入框弹出），
   挪到顶栏后 top: 100% 变成了屏幕底部以外 → 手机上点了看不到菜单，无法选生图模型 */
html body .topbar .model-menu,
html body[data-session-type] .topbar .model-menu {
  position: absolute;
  top: calc(100% + 6px);
  bottom: auto;
  left: 0;
  right: auto;
  transform: none;
}

@media (max-width: 860px) {
  html body .topbar .model-menu,
  html body[data-session-type] .topbar .model-menu {
    width: min(338px, calc(100vw - 20px));
    max-height: min(70vh, calc(100dvh - 80px));
  }
}

html body .generation-ratio-hint {
  margin: 4px 0 6px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--gpt-chip);
  color: var(--gpt-muted);
  font-size: 13px;
  line-height: 1.5;
}
