/* 无 data-theme（noscript）或变量尚未匹配时，避免 background: var(--bg) 无效透出浏览器白底 */
:root {
  --bg: #f4f6f9;
  --text: #0f1115;
  --brand-green: #48b888;
  --brand-green-hover: #58c896;
  --brand-green-dim: rgba(72, 184, 136, 0.14);
  --brand-green-rgb: 72, 184, 136;
  --chips-menu-bg: rgba(255, 255, 255, 0.98);
  --chips-menu-border: rgba(15, 17, 21, 0.1);
  --chips-menu-shadow: 0 12px 36px rgba(15, 17, 21, 0.12), 0 0 0 1px rgba(15, 17, 21, 0.05);
  --chips-menu-arrow: rgba(255, 255, 255, 0.98);
  --chips-menu-item-hover: rgba(59, 91, 219, 0.1);
}

:root[data-theme="light"] {
  --bg: #f4f6f9;
  --sidebar: #eceef2;
  --panel: #ffffff;
  --text: #0f1115;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #3b5bdb;
  --accent-hover: #2d4bc4;
  --bubble-user: #e8edff;
  --bubble-ai: #ffffff;
  --shadow: 0 1px 3px rgba(15, 17, 21, 0.06);
  --chat-media-max-w: min(100%, 280px);
  --chat-media-max-h: min(42vh, 300px);
  --chips-menu-bg: rgba(255, 255, 255, 0.98);
  --chips-menu-border: rgba(15, 17, 21, 0.1);
  --chips-menu-shadow: 0 12px 36px rgba(15, 17, 21, 0.12), 0 0 0 1px rgba(15, 17, 21, 0.05);
  --chips-menu-arrow: rgba(255, 255, 255, 0.98);
  --chips-menu-item-hover: rgba(59, 91, 219, 0.1);
}

:root[data-theme="dark"] {
  --bg: #0d0d0f;
  --sidebar: #161618;
  --panel: #1a1a1e;
  --text: #ececf1;
  --muted: #9ca3af;
  --border: #2a2a30;
  --accent: #5b7cfa;
  --accent-hover: #7c94fc;
  --bubble-user: #252532;
  --bubble-ai: #1e1e24;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --chat-media-max-w: min(100%, 280px);
  --chat-media-max-h: min(42vh, 300px);
  --chips-menu-bg: rgba(20, 22, 28, 0.97);
  --chips-menu-border: rgba(255, 255, 255, 0.12);
  --chips-menu-shadow: 0 16px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(91, 124, 250, 0.1);
  --chips-menu-arrow: rgba(20, 22, 28, 0.97);
  --chips-menu-item-hover: rgba(91, 124, 250, 0.14);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  width: 228px;
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 12px 16px;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 6px;
  min-width: 0;
  min-height: 30px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.brand-word {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--accent);
}

:root[data-theme="dark"] .brand-word {
  color: #a8c0ff;
}

/* 侧栏横版锁标（深色 / 浅色各一张，随主题切换） */
.brand-lockup {
  display: block;
  width: auto;
  max-width: 100%;
  height: 30px;
  object-fit: contain;
  object-position: left center;
}

.brand-lockup--theme-light {
  display: none;
}

:root[data-theme="light"] .brand-lockup--theme-dark {
  display: none;
}

:root[data-theme="light"] .brand-lockup--theme-light {
  display: block;
}

.brand small {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
}

.nav button {
  text-align: left;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s;
}

.nav button:hover {
  background: rgba(91, 124, 250, 0.12);
}

.nav button.active {
  background: rgba(91, 124, 250, 0.2);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
  padding-left: 8px;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 3;
  overflow: visible;
  background: var(--sidebar);
}

.sidebar-api-link {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  margin: 3px 0 0;
  padding: 5px 8px;
  min-height: 0;
  border-radius: 9px;
  border: 1px solid rgba(91, 124, 250, 0.28);
  background: rgba(91, 124, 250, 0.1);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.sidebar-api-link:hover {
  background: rgba(91, 124, 250, 0.16);
  border-color: rgba(91, 124, 250, 0.45);
}

.sidebar-api-link-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(91, 124, 250, 0.2);
  color: var(--accent);
}

.sidebar-api-link-icon svg {
  width: 14px;
  height: 14px;
  display: block;
}

.sidebar-api-link-body {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.sidebar-api-link-title {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-api-link-sub {
  display: none;
}

.sidebar-api-link-arrow {
  flex-shrink: 0;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--muted);
  opacity: 0.55;
}

.sidebar-api-link--desktop {
  border-color: rgba(46, 160, 110, 0.32);
  background: rgba(46, 160, 110, 0.08);
}

.sidebar-api-link--desktop:hover {
  background: rgba(46, 160, 110, 0.14);
  border-color: rgba(46, 160, 110, 0.48);
  color: #2ea06e;
}

.sidebar-api-link--desktop .sidebar-api-link-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(46, 160, 110, 0.16);
  color: #2ea06e;
}

.sidebar-api-link--desktop .sidebar-api-link-icon svg {
  width: 17px;
  height: 17px;
}

.sidebar-api-link--desktop .sidebar-api-link-label {
  flex: 1;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.25;
  color: #2ea06e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-api-link--desktop .sidebar-api-link-arrow {
  display: none;
}

html[data-theme="dark"] .sidebar-api-link--desktop {
  border-color: rgba(var(--brand-green-rgb), 0.28);
  background: rgba(255, 255, 255, 0.03);
}

html[data-theme="dark"] .sidebar-api-link--desktop:hover {
  background: var(--brand-green-dim);
  border-color: rgba(var(--brand-green-rgb), 0.4);
  color: var(--brand-green);
}

html[data-theme="dark"] .sidebar-api-link--desktop .sidebar-api-link-icon {
  background: var(--brand-green-dim);
  color: var(--brand-green);
}

html[data-theme="dark"] .sidebar-api-link--desktop .sidebar-api-link-label {
  color: var(--brand-green);
}

.sidebar-points {
  display: block;
  padding: 2px 2px 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.sidebar-theme-block {
  position: relative;
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-block-label {
  margin: 0 0 6px;
  padding: 0 2px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.theme-switch-wrap {
  position: relative;
}

.theme-switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(127, 127, 127, 0.08);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s, border-color 0.14s, box-shadow 0.14s;
}

:root[data-theme="light"] .theme-switch-row {
  background: rgba(0, 0, 0, 0.04);
}

.theme-switch-row:hover {
  border-color: rgba(91, 124, 250, 0.35);
  background: rgba(91, 124, 250, 0.08);
}

.theme-switch-row.is-open {
  border-color: rgba(91, 124, 250, 0.45);
  background: rgba(91, 124, 250, 0.12);
  box-shadow: inset 0 0 0 1px rgba(91, 124, 250, 0.18);
}

.theme-switch-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  line-height: 0;
  border-radius: 6px;
  background: rgba(127, 127, 127, 0.08);
}

.theme-switch-icon.is-light {
  background: rgba(251, 191, 36, 0.2);
}

.theme-switch-icon.is-dark {
  background: rgba(139, 92, 246, 0.18);
}

.theme-switch-icon.is-auto {
  background: rgba(59, 130, 246, 0.14);
}

.theme-switch-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.theme-switch-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.theme-switch-label {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

.theme-switch-sub {
  font-size: 0.68rem;
  line-height: 1.3;
  color: var(--muted);
}

.theme-switch-chevron {
  flex-shrink: 0;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--muted);
  opacity: 0.75;
}

.theme-picker-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
  z-index: 50;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
}

:root[data-theme="dark"] .theme-picker-menu {
  background: #1e1e24;
  border-color: #2e2e38;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.theme-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

.theme-picker-item:hover {
  background: rgba(127, 127, 127, 0.12);
}

.theme-picker-item.is-selected {
  background: rgba(91, 124, 250, 0.14);
}

.theme-picker-item-mark {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  line-height: 0;
  border-radius: 6px;
  background: rgba(127, 127, 127, 0.06);
}

.theme-picker-item-mark svg {
  width: 18px;
  height: 18px;
  display: block;
}

.theme-picker-item.is-selected .theme-picker-item-mark {
  box-shadow: inset 0 0 0 1px rgba(91, 124, 250, 0.25);
}

.theme-picker-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.theme-picker-item-label {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
}

.theme-picker-item-sub {
  font-size: 0.62rem;
  line-height: 1.3;
  color: var(--muted);
}

.theme-picker-item-check {
  flex-shrink: 0;
  width: 1rem;
  font-size: 0.85rem;
  color: var(--accent);
  opacity: 0;
}

.theme-picker-item.is-selected .theme-picker-item-check {
  opacity: 1;
}

.sidebar-auth-btn {
  margin-top: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(127, 127, 127, 0.35);
  background: rgba(127, 127, 127, 0.06);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.sidebar-auth-btn:hover {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.12);
}

.sidebar-auth-btn.is-login {
  border-color: rgba(91, 124, 250, 0.45);
  background: rgba(91, 124, 250, 0.12);
  color: var(--accent);
}

.sidebar-auth-btn.is-login:hover {
  border-color: rgba(91, 124, 250, 0.65);
  background: rgba(91, 124, 250, 0.2);
  color: #c4d4ff;
  box-shadow: 0 0 0 1px rgba(91, 124, 250, 0.18);
}

:root[data-theme="light"] .sidebar-auth-btn:hover {
  color: #dc2626;
  background: rgba(239, 68, 68, 0.08);
}

:root[data-theme="light"] .sidebar-auth-btn.is-login:hover {
  color: #4f6ef7;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: min(1120px, 100%);
  margin: 0 auto;
  width: 100%;
  padding: 20px 24px 10px;
}

.chat-main {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  --works-grid-cols: 5;
  /* 作品区只露第一行约 1/3；网格内仍可滚动懒加载 */
  --works-row-h: clamp(88px, 14vw, 132px);
  /* 默认只露出第一行约一半（即梦式底栏预览） */
  --works-peek-visible: calc(var(--works-row-h) / 2);
  --works-peek-hidden: calc(var(--works-row-h) - var(--works-peek-visible));
  --works-visible-rows: 5;
  --middle-bottom-reserved: clamp(200px, 30vh, 300px);
}

.main.chat-main {
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

/* —— 作品画廊（即梦式缩略图网格）—— */
.works-section {
  flex-shrink: 0;
  margin: 0;
  width: 100%;
}

.works-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.works-expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}

.works-expand-btn:hover {
  color: var(--text);
  border-color: rgba(91, 124, 250, 0.45);
  background: rgba(91, 124, 250, 0.08);
}

.works-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  justify-content: flex-end;
}

.works-search-wrap {
  flex: 1;
  min-width: 120px;
  max-width: 220px;
}

.works-search {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 12px 7px 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(127, 127, 127, 0.1);
  color: var(--text);
  font-size: 0.78rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239aa8bf' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='M10.5 10.5 14 14'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  transition: border-color 0.14s, background 0.14s;
}

.works-search::placeholder {
  color: var(--muted);
}

.works-search:focus {
  outline: none;
  border-color: rgba(91, 124, 250, 0.45);
  background-color: rgba(127, 127, 127, 0.14);
}

:root[data-theme="light"] .works-search {
  background-color: rgba(0, 0, 0, 0.04);
}

:root[data-theme="light"] .works-search:focus {
  background-color: rgba(0, 0, 0, 0.06);
}

@media (max-width: 520px) {
  .works-header-actions {
    flex-wrap: wrap;
    width: 100%;
    justify-content: space-between;
  }
  .works-search-wrap {
    max-width: none;
    order: 3;
    width: 100%;
  }
}

.works-heading {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.works-fold-toggle {
  color: var(--text);
}

.works-fold-toggle .works-heading {
  color: var(--text);
}

.works-scope-tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(127, 127, 127, 0.08);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.works-scope-tab {
  padding: 5px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.works-scope-tab:hover {
  color: var(--text);
}

.works-scope-tab.is-active {
  background: var(--panel);
  color: var(--accent);
  box-shadow: var(--shadow);
}

.works-tabs {
  display: flex;
  gap: 6px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(127, 127, 127, 0.1);
  border: 1px solid var(--border);
}

.works-tab {
  padding: 5px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.works-tab:hover {
  color: var(--text);
}

.works-tab.is-active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.works-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  max-height: min(62vh, calc(var(--works-row-h) * var(--works-visible-rows, 5) + 48px));
  overflow-y: auto;
  padding: 2px 2px 8px;
  width: 100%;
  box-sizing: border-box;
}

.works-grid.is-loading {
  pointer-events: none;
}

.works-skeleton-card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.02) 42%,
    rgba(255, 255, 255, 0.07) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.06);
  animation: works-skeleton-float 1.8s ease-in-out infinite;
  animation-delay: var(--wave-delay, 0s);
  transform: translateY(0);
}

.works-skeleton-card::before {
  content: '';
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(125, 255, 176, 0.14) 48%,
    rgba(255, 213, 106, 0.18) 52%,
    transparent 62%
  );
  animation: works-skeleton-wave 1.6s ease-in-out infinite;
  animation-delay: calc(var(--wave-delay, 0s) + var(--wave-col, 0) * 0.08s);
}

.works-skeleton-card::after {
  content: '';
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 14%;
  height: 10%;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

@keyframes works-skeleton-wave {
  0% {
    transform: translateX(-28%) translateY(8%) rotate(8deg);
    opacity: 0.35;
  }
  50% {
    transform: translateX(18%) translateY(-6%) rotate(8deg);
    opacity: 0.95;
  }
  100% {
    transform: translateX(64%) translateY(8%) rotate(8deg);
    opacity: 0.35;
  }
}

@keyframes works-skeleton-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(calc(-3px - var(--wave-col, 0) * 0.6px));
  }
}

/* 主内容栏：对话（局部滚）→ 输入框 → 作品；鼠标在作品区时整块统一滚 */
.chat-content-column {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-scroll--local {
  order: 1;
  flex: 1 1 0;
  min-height: 0;
}

.chat-queue-dock {
  order: 2;
}

.composer-block {
  order: 3;
}

.works-feed-scroll {
  order: 3;
}

/* 无对话：即梦首页式，输入框紧跟标题，作品在输入框下 */
.chat-main:not(.has-chat) .chat-scroll--local {
  order: 3;
  flex: 0 0 auto;
  max-height: 0;
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.chat-main:not(.has-chat) .composer-block {
  order: 1;
}

.chat-main:not(.has-chat) .works-feed-scroll {
  order: 2;
}

/* —— 探索：大输入框 + 作品画廊 —— */
.chat-main.is-inspiration .chat-content-column {
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* 探索首页（无对话）：主栏可滚动；作品区随内容高度，不强行撑满留黑块 */
.chat-main.is-inspiration:not(.has-chat) .chat-content-column {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  justify-content: flex-start;
}

.chat-main.is-inspiration:not(.has-chat) .works-feed-scroll {
  flex: 0 0 auto;
  flex-grow: 0;
  min-height: 0;
  max-height: min(52vh, calc(100dvh - 340px));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.chat-main.is-inspiration:not(.has-chat) .composer-block {
  z-index: 1;
}

.chat-main:not(.has-chat) .chat-content-column {
  flex: 0 0 auto;
  overflow: visible;
}

.chat-main.is-inspiration .composer-block {
  flex-shrink: 0;
  width: 100%;
  max-width: min(800px, 100%);
  margin: 0 auto;
  padding: 4px 20px 10px;
  border-top: none;
  background: transparent;
  box-sizing: border-box;
}

.chat-main.is-inspiration .composer-panel {
  min-height: clamp(118px, 17vh, 152px);
  padding: 14px 16px 10px;
  border-radius: 20px;
  gap: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
}

.chat-main.is-inspiration .composer-panel textarea {
  min-height: 80px;
  max-height: min(30vh, 220px);
  font-size: 0.96rem;
  line-height: 1.5;
}

.chat-main.is-inspiration .composer-toolbar {
  margin-top: 4px;
  padding-top: 2px;
}

.chat-main.is-inspiration .works-feed-scroll {
  flex: 0 0 auto;
  flex-grow: 0;
  min-height: 0;
  max-height: min(46vh, 440px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid var(--border);
  padding: 10px 20px max(12px, env(safe-area-inset-bottom));
}

.chat-main.is-inspiration.has-chat .works-feed-scroll {
  flex: 1 1 0;
  max-height: none;
}

.chat-main.is-inspiration .works-section--below-input.works-section--mobile-peek #works-grid {
  max-height: none;
  overflow: visible;
}

/* —— 创作：聊天记录为主，输入框紧凑 —— */
.chat-main.is-generation .chat-content-column {
  justify-content: flex-start;
  overflow: hidden;
}

.chat-main.is-generation .composer-block {
  padding: 6px 16px 8px;
}

.chat-main.is-generation .composer-panel {
  min-height: 0;
  padding: 8px 12px 8px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.chat-main.is-generation .composer-panel textarea {
  min-height: 42px;
  max-height: min(24vh, 160px);
}

.chat-main.is-generation .works-feed-scroll {
  display: none !important;
}

.chat-main.is-generation .chat-scroll--local {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  opacity: 1;
  pointer-events: auto;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-padding-bottom: 32px;
  padding-bottom: 0;
}

/* 创作中：消息从顶部往下排，输出区尽量大；执行状态不贴输入框底 */
.chat-main.is-generation.has-chat .chat-messages-list::before,
.chat-main.is-generation.has-chat .chat-scroll--local > .chat-messages-list::before {
  display: none;
  content: none;
  flex: 0 0 0;
  min-height: 0;
}

.chat-main.is-generation.has-chat .chat-messages-list {
  justify-content: flex-start;
  min-height: auto;
  padding-bottom: 28px;
  box-sizing: border-box;
}

.chat-main.is-generation.has-chat .chat-scroll--local > .chat-messages-list {
  min-height: auto;
}

.chat-main.is-inspiration.has-chat .chat-scroll--local {
  flex: 0 0 auto;
  max-height: 0;
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.chat-content-column.is-global-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.chat-scroll--local {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.chat-content-column.is-global-scroll .chat-scroll--local {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
}

/* 即梦式：输入框在上，作品在下方；默认只 peek 第一行，展开后可滚 */
.works-feed-scroll {
  flex: 0 0 auto;
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 6px 16px max(8px, env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.chat-main.has-chat.is-inspiration .works-feed-scroll {
  flex: 1 1 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.works-feed-scroll.is-gallery-expanded {
  flex: 1 1 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.works-section--below-input {
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  width: 100%;
}

/* 作品网格由外层 #works-feed-scroll 滚动，避免双层高度留白 */
.works-feed-scroll .works-grid,
.works-feed-scroll #works-grid {
  max-height: none;
  overflow: visible;
}

/* 生成页未展开时：仅露一行预览 */
.chat-main.is-generation .works-section--below-input.works-section--mobile-peek:not(.is-gallery-expanded) #works-grid {
  max-height: calc(var(--works-peek-visible) + 8px);
  overflow: hidden;
}

.chat-main.is-inspiration .works-feed-scroll .works-grid,
.chat-main.is-inspiration .works-feed-scroll #works-grid {
  max-height: none;
  overflow: visible;
}

.works-section--below-input.is-gallery-expanded #works-grid,
.works-feed-scroll.is-gallery-expanded .works-section--below-input #works-grid {
  max-height: min(42vh, 420px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.chat-main.has-chat .works-section--below-input #works-grid {
  max-height: min(42vh, 420px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.works-section--mobile-peek .works-fold-body {
  overflow: visible;
  min-height: 0;
}

.works-section--mobile-peek .works-header {
  margin-bottom: 6px;
}

.works-section--mobile-peek .works-header-actions {
  margin-bottom: 6px;
}

.works-section--mobile-peek:not(.works-section--below-input) .works-grid,
.works-section--mobile-peek:not(.works-section--below-input) #works-grid {
  max-height: calc(var(--works-peek-visible) + 6px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.works-load-sentinel {
  grid-column: 1 / -1;
  width: 100%;
  height: 2px;
  margin: 0;
  padding: 0;
  border: 0;
  pointer-events: none;
}

.works-section--mobile-peek.is-gallery-expanded {
  margin-bottom: 0;
  padding-bottom: 0;
}

.works-section--mobile-peek.is-gallery-expanded .works-grid,
.works-section--mobile-peek.is-gallery-expanded #works-grid {
  max-height: min(46vh, 440px);
}

.works-grid:empty {
  display: none;
}

.works-empty[hidden] {
  display: none !important;
}

.works-empty {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: rgba(127, 127, 127, 0.06);
}

.works-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 3 / 4;
  background: var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 2px 10px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  isolation: isolate;
}

:root[data-theme="light"] .works-card {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 10px rgba(15, 23, 42, 0.08);
}

.works-card-blur {
  position: absolute;
  inset: -12%;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(22px) saturate(1.12) brightness(0.92);
  transform: scale(1.08);
  pointer-events: none;
}

.works-card-blur::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.12);
  pointer-events: none;
}

:root[data-theme="light"] .works-card-blur::after {
  background: rgba(255, 255, 255, 0.18);
}

.works-card:hover {
  transform: translateY(-2px);
  border-color: rgba(91, 124, 250, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 28px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(91, 124, 250, 0.08);
}

.works-card--game:hover {
  border-color: rgba(160, 172, 220, 0.36);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 10px 28px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(140, 155, 210, 0.12);
}

.works-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.works-card img,
.works-card video {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
}

.works-card-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(232, 236, 250, 0.96);
  background: rgba(18, 22, 38, 0.52);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.works-card-badge--app {
  border-color: rgba(168, 178, 220, 0.28);
  color: rgba(228, 232, 248, 0.98);
}

.works-card-badge--game {
  border-color: rgba(172, 182, 220, 0.3);
  color: rgba(230, 234, 248, 0.98);
}

.works-card-badge--article {
  border-color: rgba(188, 194, 228, 0.28);
  color: rgba(236, 238, 250, 0.98);
}

.works-card--app {
  background: var(--panel);
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.works-card--game {
  border-color: rgba(140, 152, 200, 0.16);
  background:
    linear-gradient(180deg, rgba(120, 132, 188, 0.05) 0%, transparent 38%),
    var(--panel);
}

.works-card-media-hit {
  position: relative;
  display: block;
  width: 100%;
  flex: 1;
  min-height: 88px;
  padding: 0;
  margin: 0;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(165deg, rgba(91, 124, 250, 0.1) 0%, rgba(18, 22, 34, 0.95) 42%, rgba(10, 12, 18, 1) 100%);
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: inherit;
  overflow: hidden;
}

.works-card--game .works-card-media-hit {
  flex: 0 0 auto;
  aspect-ratio: 4 / 3;
  width: 100%;
  min-height: 0;
  background:
    linear-gradient(165deg, rgba(100, 112, 168, 0.08) 0%, rgba(16, 20, 34, 0.96) 44%, rgba(8, 10, 16, 1) 100%);
}

:root[data-theme="light"] .works-card-media-hit {
  border-bottom-color: rgba(0, 0, 0, 0.08);
  background: linear-gradient(165deg, rgba(91, 124, 250, 0.08) 0%, #eef1f8 100%);
}

:root[data-theme="light"] .works-card--game .works-card-media-hit {
  background: linear-gradient(165deg, rgba(120, 132, 188, 0.08) 0%, #eef1f8 100%);
}

.works-card-media-hit:hover {
  filter: brightness(1.06);
}

.works-card-media-hit:focus-visible {
  outline: 2px solid rgba(91, 124, 250, 0.55);
  outline-offset: -2px;
}

.works-card-media-blur {
  position: absolute;
  inset: -10%;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(20px) saturate(1.28) brightness(1.08);
  transform: scale(1.1);
  pointer-events: none;
}

.works-card-media-blur::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.08);
  pointer-events: none;
}

:root[data-theme='light'] .works-card-media-blur::after {
  background: rgba(255, 255, 255, 0.22);
}

.works-card-media-hit.has-media-blur {
  background: #121622;
}

.works-card--game .works-card-media-hit.has-media-blur,
.works-card--game .works-card-media-hit {
  background: transparent;
}

:root[data-theme='light'] .works-card-media-hit.has-media-blur {
  background: #e8ebf2;
}

:root[data-theme='light'] .works-card--game .works-card-media-hit.has-media-blur {
  background: #e6f4ec;
}

.works-card-media-hit.has-media-blur img {
  position: relative;
  z-index: 1;
  object-fit: cover;
  object-position: center;
}

.works-card--app .works-card-media-hit.has-media-blur img,
.works-card--game .works-card-media-hit img {
  object-fit: cover;
  object-position: center;
}

.works-card-media--embed.has-media-blur .webpage-preview-scaler {
  z-index: 1;
}

.html-app-card-actions {
  display: flex;
  gap: 6px;
  padding: 8px 8px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

:root[data-theme="light"] .html-app-card-actions {
  border-top-color: rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.02);
}

.works-card--app .html-app-card-actions {
  margin-top: auto;
}

.html-app-card-btn {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.html-app-card-btn:hover {
  border-color: rgba(91, 124, 250, 0.4);
  background: rgba(91, 124, 250, 0.1);
}

.html-app-card-btn--primary {
  border-color: rgba(91, 124, 250, 0.45);
  color: var(--accent);
  background: rgba(91, 124, 250, 0.12);
}

.html-app-card-btn--primary:hover {
  background: rgba(91, 124, 250, 0.2);
}

.works-card-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 88px;
  color: rgba(186, 194, 228, 0.72);
  background:
    radial-gradient(120% 90% at 30% 20%, rgba(120, 132, 188, 0.14), transparent 55%),
    radial-gradient(90% 70% at 75% 65%, rgba(100, 112, 168, 0.1), transparent 50%),
    linear-gradient(165deg, rgba(18, 22, 36, 0.98) 0%, rgba(10, 12, 20, 1) 100%);
}

.works-card-placeholder svg {
  width: 40px;
  height: 40px;
  opacity: 0.9;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.works-lightbox-app-frame {
  width: min(960px, 92vw);
  height: min(72vh, 680px);
  border: 0;
  border-radius: 12px;
  background: #0a0a0c;
}

.works-card-play {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.works-card-play svg {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.45));
}

.works-card-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 24px 8px 8px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #fff;
  text-align: left;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.works-lightbox {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  cursor: zoom-out;
}

.works-lightbox[hidden] {
  display: none !important;
}

.works-lightbox-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: min(92vw, 920px);
  max-height: min(88vh, 900px);
  cursor: default;
  padding-top: 8px;
  box-sizing: border-box;
}

.works-lightbox-body {
  width: 100%;
  max-height: min(80vh, 780px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-top: 44px;
  box-sizing: border-box;
}

.works-lightbox-media-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: min(72vh, 720px);
}

.works-lightbox-body img,
.works-lightbox-body video,
.works-lightbox-body .works-lightbox-video {
  display: block;
  max-width: 100%;
  max-height: min(72vh, 720px);
  border-radius: 12px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

.works-lightbox-video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 6;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.works-lightbox-video-play[hidden] {
  display: none !important;
}

.works-lightbox-video-play:hover {
  background: rgba(15, 23, 42, 0.72);
  transform: translate(-50%, -50%) scale(1.04);
}

.works-lightbox-video-play svg {
  margin-left: 3px;
  pointer-events: none;
}

/* 对话内生成图/视频点击放大：直角 */
.works-lightbox-body .works-lightbox-media-wrap--chat img,
.works-lightbox-body .works-lightbox-media-wrap--chat video {
  border-radius: 0;
}

.works-lightbox-toolbar {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  padding: 4px;
  border-radius: 12px;
  background: rgba(8, 12, 20, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.works-lightbox-toolbar[hidden] {
  display: none !important;
}

.works-lightbox-actions {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  padding: 4px;
  border-radius: 12px;
  background: rgba(8, 12, 20, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.works-lightbox-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  text-decoration: none;
  box-sizing: border-box;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.works-lightbox-btn svg {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

.works-lightbox-btn--download:hover {
  background: rgba(56, 189, 248, 0.28);
  color: #e0f2fe;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(56, 189, 248, 0.22);
}

.works-lightbox-btn--close:hover {
  background: rgba(248, 113, 113, 0.28);
  color: #fee2e2;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(248, 113, 113, 0.2);
}

.works-lightbox-btn:active {
  transform: translateY(0) scale(0.96);
}

.works-lightbox-btn:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

.works-lightbox-cap {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.88rem;
  text-align: center;
  pointer-events: none;
}

.msg.works-chat-highlight {
  outline: 2px solid rgba(91, 124, 250, 0.65);
  outline-offset: 4px;
  border-radius: 12px;
  transition: outline-color 0.2s;
}

.provider-rail {
  margin: 12px 0 0;
  padding: 0 2px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-search-wrap {
  flex-shrink: 0;
  margin-bottom: 0;
}

.sidebar-search {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px 7px 32px;
  border-radius: 9px;
  border: none;
  background: rgba(127, 127, 127, 0.12);
  color: var(--text);
  font-size: 0.76rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239aa8bf' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='M10.5 10.5 14 14'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}

.sidebar-search::placeholder {
  color: var(--muted);
}

.sidebar-search:focus {
  outline: none;
  background: rgba(127, 127, 127, 0.16);
  box-shadow: inset 0 0 0 1px rgba(91, 124, 250, 0.45);
}

:root[data-theme="light"] .sidebar-search {
  background: rgba(0, 0, 0, 0.05);
}

:root[data-theme="light"] .sidebar-search:focus {
  background: rgba(0, 0, 0, 0.07);
}

.sidebar-search-empty {
  margin: 0 0 8px;
  padding: 10px 8px;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
  border-radius: 8px;
  background: rgba(127, 127, 127, 0.08);
}

.provider-rail-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 0 10px;
}

.provider-card {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 8px 8px;
  border-radius: 11px;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.14s ease, box-shadow 0.14s ease, padding 0.14s ease;
}

.provider-card[hidden] {
  display: none !important;
}

.provider-card:focus-visible {
  outline: 2px solid rgba(91, 124, 250, 0.55);
  outline-offset: 1px;
}

.provider-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
}

.provider-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  line-height: 1.25;
}

/* 功能关键字常驻显示 */
.provider-tags {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0 0 0 1px;
  min-height: 0;
  opacity: 1;
  overflow: hidden;
  pointer-events: auto;
}

.provider-tag-sep {
  flex-shrink: 0;
  margin: 0 2px;
  font-size: 0.52rem;
  line-height: 1;
  color: var(--muted);
  opacity: 0.5;
  user-select: none;
}

.provider-tag {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 400;
  line-height: 1.2;
  cursor: default;
  white-space: nowrap;
  user-select: none;
  pointer-events: none;
}

.provider-tag.is-tag-hit {
  color: var(--accent);
  font-weight: 550;
}

.provider-card:hover {
  background: rgba(127, 127, 127, 0.1);
}

:root[data-theme="light"] .provider-card:hover {
  background: rgba(0, 0, 0, 0.05);
}

.provider-card.is-active {
  background: rgba(91, 124, 250, 0.14);
  box-shadow: inset 0 0 0 1px rgba(91, 124, 250, 0.22);
}

.provider-card.is-active::before {
  display: none;
}

.provider-card--home.is-active {
  background: rgba(91, 124, 250, 0.16);
}

.provider-card.is-unavailable {
  opacity: 0.42;
}

.provider-card.is-unavailable .provider-status {
  display: inline;
}

.provider-mark-wrap {
  flex: 0 0 auto;
  align-self: stretch;
  width: auto;
  height: auto;
  aspect-ratio: 1;
  min-height: 26px;
  max-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(127, 127, 127, 0.12);
  border: none;
}

:root[data-theme="light"] .provider-mark-wrap {
  background: rgba(0, 0, 0, 0.06);
}

.provider-card.is-active .provider-mark-wrap {
  background: rgba(91, 124, 250, 0.2);
  box-shadow: none;
}

.provider-mark-wrap--home {
  background: rgba(91, 124, 250, 0.12);
  border-color: rgba(91, 124, 250, 0.2);
  color: var(--accent);
}

.provider-mark-wrap--codex {
  background: rgba(13, 148, 136, 0.14);
  border-color: rgba(13, 148, 136, 0.32);
}

.provider-mark {
  width: 72%;
  height: 72%;
  max-width: 28px;
  max-height: 28px;
  display: grid;
  place-items: center;
  line-height: 0;
}

.provider-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

:root[data-theme="dark"] .provider-mark-wrap--home,
:root[data-theme="dark"] .provider-mark--home {
  color: #a8c0ff;
}

:root[data-theme="dark"] .provider-mark--gpt svg,
:root[data-theme="dark"] .provider-mark--grok svg {
  color: #f4f4f5;
}

:root[data-theme="light"] .provider-mark--gpt svg,
:root[data-theme="light"] .provider-mark--grok svg {
  color: #0d0d0d;
}

.provider-name {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.015em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.provider-card--home .provider-name {
  font-weight: 600;
}

.provider-card.is-active .provider-name {
  font-weight: 600;
  color: var(--text);
}

.provider-card.is-active .provider-tag {
  color: var(--accent);
  opacity: 0.88;
}

.provider-status {
  display: none;
  flex-shrink: 0;
  font-size: 0.6rem;
  font-weight: 500;
  color: var(--muted);
}

.link-context-wrap--compact {
  margin-top: 18px;
}

.model-preset-row {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.model-preset-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.model-preset-btn:hover {
  border-color: rgba(91, 124, 250, 0.45);
}

.model-preset-btn.active {
  background: rgba(91, 124, 250, 0.18);
  border-color: rgba(91, 124, 250, 0.55);
  font-weight: 600;
}

.model-dropdown {
  position: relative;
  width: auto;
  max-width: 100%;
}

.model-dropdown.is-open {
  z-index: 80;
}

.model-dropdown--compact .model-dropdown-trigger {
  padding: 5px 10px 5px 6px;
  border-radius: 999px;
  font-size: 0.75rem;
  max-width: min(220px, 58vw);
}

.model-dropdown--compact .model-dropdown-mark {
  width: 18px;
  height: 18px;
}

.model-dropdown--compact .model-dropdown-mark svg {
  width: 16px;
  height: 16px;
}

.model-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px 12px 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(127, 127, 127, 0.08);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.model-dropdown-trigger:hover,
.model-dropdown.is-open .model-dropdown-trigger {
  border-color: rgba(91, 124, 250, 0.45);
  background: rgba(91, 124, 250, 0.08);
}

:root[data-theme="dark"] .model-dropdown-trigger:hover,
:root[data-theme="dark"] .model-dropdown.is-open .model-dropdown-trigger {
  background: rgba(255, 255, 255, 0.06);
}

.model-dropdown-mark {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  line-height: 1;
}

.model-dropdown-mark svg {
  width: 20px;
  height: 20px;
  display: block;
}

.model-dropdown-mark--auto {
  font-size: 0.95rem;
  color: var(--accent);
}

.model-dropdown-label {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 120px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-dropdown--compact .model-dropdown-label {
  max-width: 140px;
}

.model-dropdown-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted);
  flex-shrink: 0;
  margin-left: 2px;
}

.model-dropdown-menu {
  position: absolute;
  left: 0;
  width: max-content;
  max-width: calc(100vw - 24px);
  z-index: 81;
  max-height: min(280px, 38vh);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(127, 127, 127, 0.45) transparent;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
}

.model-dropdown-menu.is-drop-up:not(.is-fixed) {
  bottom: calc(100% + 6px);
  top: auto;
}

.model-dropdown-menu.is-drop-down:not(.is-fixed) {
  top: calc(100% + 6px);
  bottom: auto;
}

.model-dropdown-menu.is-fixed {
  position: fixed;
  z-index: 12000;
}

.model-dropdown-menu::-webkit-scrollbar {
  width: 6px;
}

.model-dropdown-menu::-webkit-scrollbar-thumb {
  background: rgba(127, 127, 127, 0.42);
  border-radius: 999px;
}

:root[data-theme="dark"] .model-dropdown-menu {
  background: #1e1e24;
  border-color: #2e2e38;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.model-dropdown-group-label {
  padding: 8px 10px 4px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.model-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 0.8125rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

.model-dropdown-item:hover {
  background: rgba(91, 124, 250, 0.12);
}

.model-dropdown-item.is-selected {
  background: rgba(91, 124, 250, 0.16);
}

.model-dropdown-item-mark {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.model-dropdown-item-mark svg {
  width: 20px;
  height: 20px;
}

.model-dropdown-item-mark--auto {
  font-size: 1rem;
  color: var(--accent);
}

.model-dropdown-item-body {
  flex: 0 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.model-dropdown-item-label {
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}

.model-dropdown-item-sub {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.35;
  white-space: nowrap;
}

.model-dropdown-item-check {
  flex-shrink: 0;
  width: 1em;
  font-size: 0.85rem;
  color: var(--accent);
  opacity: 0;
}

.model-dropdown-item.is-selected .model-dropdown-item-check {
  opacity: 1;
}

.model-pick select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  padding: 0;
  border: none;
  appearance: none;
  z-index: 2;
}

.composer-copy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.composer-mode-hint {
  margin: 0 0 8px;
  padding: 0;
}

.composer-mode-hint:not([hidden]) {
  display: block;
}

.sidebar-hint,
.sidebar-note {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0 8px;
  line-height: 1.5;
  margin: 12px 0 0;
}

.sidebar-hint code {
  font-size: 0.85em;
  background: var(--panel);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.sidebar-note {
  margin-top: 10px;
  opacity: 0.92;
}

.sidebar-doc a {
  color: var(--accent);
  text-decoration: none;
}

.sidebar-doc a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.icp-footer {
  margin-top: 10px;
  margin-bottom: 0;
  text-align: center;
}

.icp-footer a {
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
}

.icp-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.scene-label {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0 8px;
  margin-top: 14px;
  display: block;
}

.scene-select {
  width: calc(100% - 16px);
  margin: 6px 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.85rem;
}

/* 标题区：紧凑居中，避免占用过多纵向空间 */
.chat-hero-stage {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  padding: 10px 20px 6px;
  box-sizing: border-box;
}

.chat-hero {
  flex-shrink: 0;
  text-align: center;
  padding: 0;
  width: 100%;
  max-width: 720px;
  box-sizing: border-box;
}

/* 有对话时保留标题，略缩小（仍紧贴输入框上方） */
.chat-hero.is-compact {
  padding-bottom: 8px;
}

.chat-hero.is-compact .chat-hero-title {
  font-size: clamp(1.12rem, 2.8vw, 1.42rem);
  line-height: 1.26;
}

.chat-hero-title {
  margin: 0;
  text-align: center;
  font-size: clamp(1.28rem, 3.2vw, 1.72rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.28;
  color: var(--text);
  white-space: normal;
}

.chat-hero-lead,
.chat-hero-tail {
  font-weight: 700;
  color: var(--text);
}

.chat-hero-accent {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0 0.12em;
  padding: 0 2px;
  border: none;
  background: none;
  font: inherit;
  font-size: 1em;
  font-weight: 700;
  line-height: inherit;
  cursor: pointer;
  vertical-align: baseline;
  border-radius: 6px;
  transition: opacity 0.15s ease;
}

.chat-hero-accent:hover {
  opacity: 0.9;
}

.chat-hero-accent-text {
  background: linear-gradient(92deg, #38bdf8 0%, #22d3ee 48%, #5b7cfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

:root[data-theme="light"] .chat-hero-accent-text {
  background: linear-gradient(92deg, #0284c7 0%, #0891b2 50%, #4f46e5 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.chat-hero-accent-caret {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-top: 0.15em;
  border-right: 2px solid #38bdf8;
  border-bottom: 2px solid #38bdf8;
  transform: rotate(45deg);
  flex-shrink: 0;
}

/* 探索 / 创作 视图切换 */
.main-mode-tabs {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 auto;
  padding: 6px 20px 8px;
  max-width: min(800px, 100%);
  box-sizing: border-box;
}

.main-mode-tab {
  padding: 7px 22px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.main-mode-tab:hover {
  color: var(--text);
  background: rgba(127, 127, 127, 0.12);
}

.main-mode-tab.is-active {
  color: var(--text);
  background: rgba(127, 127, 127, 0.18);
  box-shadow: inset 0 0 0 1px var(--border);
}

:root[data-theme="light"] .main-mode-tab.is-active {
  background: rgba(0, 0, 0, 0.06);
}

.chat-main.has-chat .chat-hero-stage {
  min-height: 0;
  padding: 6px 16px 2px;
  align-items: flex-end;
}

.chat-main:not(.has-chat) .chat-scroll {
  flex: 1 1 0;
  max-height: none;
  margin-bottom: 0;
}

.chat-main:not(.has-chat) .composer-block {
  gap: 8px;
}

.composer-block {
  flex-shrink: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 0;
  position: relative;
  z-index: 2;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 6px 16px 8px;
  box-sizing: border-box;
}

.composer-bar {
  width: 100%;
  flex-shrink: 0;
}

/* 输入区：附件 + 试试 + 输入框 + 作品同宽左对齐 */
.composer-main-col {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.composer-intro-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.composer-intro-row .prompt-chips-panel {
  flex: 1;
  min-width: 0;
  overflow: visible;
}

.composer-intro-row .prompt-chips-panel.is-chips-menu-open {
  overflow: visible;
  z-index: 50;
}

.composer-intro-row .prompt-chips.is-chips-menu-open {
  z-index: 50;
}

.composer-intro-row .prompt-chips {
  flex: 1;
  min-width: 0;
  overflow: visible;
}

.attach-thumbs {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  align-content: flex-start;
  max-height: 120px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0;
  flex: 0 0 auto;
  width: 100%;
}

.attach-thumbs.has-files {
  display: flex;
}

.attach-file-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: min(240px, 72vw);
  padding: 8px 32px 8px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.08);
  flex-shrink: 0;
}

:root[data-theme="dark"] .attach-file-card {
  background: rgba(148, 163, 184, 0.12);
}

.attach-file-card-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(91, 124, 250, 0.14);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.attach-file-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attach-file-card-meta {
  min-width: 0;
  flex: 1 1 auto;
}

.attach-file-card-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-file-card-sub {
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  line-height: 20px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.attach-thumb-remove:hover {
  background: rgba(200, 50, 50, 0.95);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn-attach {
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(127, 127, 127, 0.08);
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.btn-attach:hover {
  color: var(--accent);
  border-color: rgba(91, 124, 250, 0.45);
  background: rgba(91, 124, 250, 0.1);
}

.btn-attach:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.site-icp-bar {
  text-align: center;
  margin: 12px 0 0;
  padding: 10px 8px 0;
  font-size: 0.72rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.site-icp-bar a {
  color: var(--muted);
  text-decoration: none;
}

.site-icp-bar a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.attach-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ai-result-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.ai-code-block {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(91, 124, 250, 0.22);
  background: rgba(0, 0, 0, 0.32);
  overflow-x: auto;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: min(420px, 50vh);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.ai-html-source {
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.ai-html-source summary {
  cursor: pointer;
  padding: 8px 12px;
  font-size: 0.76rem;
  color: var(--muted);
  user-select: none;
  list-style: none;
}

.ai-html-source summary::-webkit-details-marker {
  display: none;
}

.ai-html-source summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.15s;
}

.ai-html-source[open] summary::before {
  transform: rotate(90deg);
}

.ai-html-source .ai-code-block {
  margin: 0;
  border: none;
  border-radius: 0;
  border-top: 1px solid var(--border);
  max-height: min(360px, 44vh);
}

html[data-theme='light'] .ai-code-block {
  background: #f3f4f6;
}

.ai-code-block code {
  font-family: inherit;
  color: inherit;
}

.ai-app-card-summary {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
}

.ai-text-block {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
  font-size: 0.95rem;
}

.ai-text-block .ai-copy-inline-img {
  display: block;
  width: auto;
  height: auto;
  max-width: var(--chat-media-max-w, min(100%, 280px));
  max-height: var(--chat-media-max-h, min(42vh, 300px));
  object-fit: contain;
  margin: 10px 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: zoom-in;
}

.ai-text-block--has-html {
  white-space: normal;
}

.ai-text-block--app {
  padding: 0;
}

.ai-app-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  color: inherit;
  background: var(--panel);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ai-app-card:hover {
  border-color: rgba(91, 124, 250, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.ai-app-card--game .ai-app-card-cover {
  background: transparent;
}

.ai-app-card--app .ai-app-card-cover {
  background: linear-gradient(145deg, rgba(91, 124, 250, 0.16), rgba(var(--brand-green-rgb), 0.08));
}

.ai-app-card-cover {
  position: relative;
  display: block;
  width: 100%;
  max-width: 320px;
  max-height: 240px;
  min-height: 120px;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: none;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: #0c0c0e;
  color: inherit;
  font: inherit;
  text-align: inherit;
}

.ai-app-card-cover:disabled {
  cursor: default;
}

.ai-app-card-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ai-app-card-cover.has-cover-blur .ai-app-card-cover-img {
  position: relative;
  z-index: 1;
  object-fit: cover;
  object-position: center;
}

.ai-app-card-cover--preview {
  cursor: default;
}

.ai-app-card-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  pointer-events: none;
  background: #0c0c0e;
}

.ai-app-card-preview-frame--interactive {
  pointer-events: auto;
}

.webpage-preview-scaler--fit:has(.ai-app-card-preview-frame--interactive) {
  pointer-events: auto;
}

.game-cover-scaler:has(.ai-app-card-preview-frame--interactive) {
  pointer-events: auto;
}

.webpage-preview-scaler--fit {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0c12;
  pointer-events: none;
}

.game-cover-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.game-cover-scaler {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
}

.game-cover-scaler .webpage-preview-frame,
.game-cover-scaler .ai-app-card-preview-frame {
  display: block;
  border: 0;
  pointer-events: none;
  background: #0a0c12;
}

.webpage-preview-frame--fit {
  border: 0;
  background: #0a0c12;
  pointer-events: none;
}

.ai-app-card-preview-frame--thumb,
.webpage-preview-frame--thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 640px;
  height: 360px;
  transform: scale(0.3333);
  transform-origin: 0 0;
  border: 0;
  background: #fff;
  pointer-events: none;
}

.ai-app-card-cover--try .ai-app-card-preview-frame--thumb {
  pointer-events: none;
}

.webpage-preview-scaler--thumb {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0c0c0e;
  pointer-events: none;
}

.ai-app-card-cover--game-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 70%, rgba(8, 10, 20, 0.35) 100%);
  z-index: 2;
}

.ai-app-card-cover-blur {
  position: absolute;
  inset: -10%;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: blur(22px) saturate(1.14) brightness(0.9);
  transform: scale(1.1);
  pointer-events: none;
}

.ai-app-card-cover-blur::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
}

.ai-app-card-cover.has-cover-blur {
  background: #0a0c12;
}

.ai-app-card-cover.has-cover-blur .webpage-preview-scaler {
  z-index: 1;
}

.ai-app-card-cover--try {
  cursor: pointer;
  pointer-events: auto;
}

.ai-app-card-loading--thumb {
  min-height: 0;
  position: absolute;
  inset: 0;
  z-index: 2;
  background: rgba(8, 9, 10, 0.55);
  font-size: 0.72rem;
}

.webpage-preview-scaler {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #0c0c0e;
  pointer-events: none;
}

.webpage-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #fff;
}

.works-card-media--embed {
  position: relative;
  overflow: hidden;
  background: transparent;
}

.works-card-media--embed .webpage-preview-scaler {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: transparent;
  pointer-events: none;
}

.works-card-media--embed .game-cover-stage {
  background: transparent;
}

.works-card-media--embed .webpage-preview-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: transparent;
}

.ai-app-card-cover--clickable {
  cursor: pointer;
}

.ai-app-card-cover-hint {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 500;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.ai-app-card:hover .ai-app-card-cover-hint {
  background: rgba(91, 124, 250, 0.88);
  border-color: rgba(255, 255, 255, 0.2);
}

.ai-result-tools .ai-app-open-try {
  border-color: rgba(91, 124, 250, 0.45);
  color: var(--accent);
  background: rgba(91, 124, 250, 0.1);
}

.ai-result-tools .ai-app-open-try:hover {
  background: rgba(91, 124, 250, 0.18);
  border-color: rgba(91, 124, 250, 0.65);
}

.ai-app-card-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 96px;
  color: var(--muted);
}

.ai-app-card-placeholder svg {
  width: 44px;
  height: 44px;
  opacity: 0.85;
}

.ai-app-card-loading {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 96px;
  font-size: 0.82rem;
  color: var(--muted);
}

.ai-app-card-info {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 6px;
  padding: 12px 14px 14px;
  min-width: 0;
}

.ai-app-card .html-app-card-actions {
  flex-shrink: 0;
  margin: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.14);
}

.ai-result-tools:empty {
  display: none;
  margin: 0;
}

.msg.ai > .ai-result-tools {
  margin-top: 10px;
}

.ai-app-card-badge {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  color: #fff;
  background: rgba(91, 124, 250, 0.72);
}

.ai-app-card--game .ai-app-card-badge {
  background: rgba(var(--brand-green-rgb), 0.82);
  color: #0a1a12;
}

.ai-app-card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--text);
}

.ai-app-card-url {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--accent);
  word-break: break-all;
}

.ai-app-card-hint {
  margin: 0;
  font-size: 0.74rem;
  color: var(--muted);
}

.ai-app-card-hint--error {
  color: #f87171;
}

.works-card-title--below {
  position: static;
  display: block;
  padding: 8px 10px 2px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  background: transparent;
  text-shadow: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

:root[data-theme="light"] .works-card-title--below {
  border-top-color: rgba(0, 0, 0, 0.06);
}

.works-card--app .works-card-media-hit img {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.ai-html-preview {
  margin: 4px 0 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #0d0d0f;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.ai-html-preview-frame {
  display: block;
  width: 100%;
  min-height: min(72vh, 640px);
  height: min(72vh, 640px);
  border: none;
  background: #fff;
}

@media (max-width: 720px) {
  .ai-html-preview-frame {
    min-height: min(68vh, 520px);
    height: min(68vh, 520px);
  }
}

.ai-copy-ref-cap {
  margin-top: 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.ai-copy-ref-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.ai-copy-ref-img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.btn-mini {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.3;
}

.btn-mini-ico {
  display: inline-flex;
  flex-shrink: 0;
  line-height: 0;
  opacity: 0.92;
}

.btn-mini-ico svg {
  display: block;
}

.result-img-inline,
.result-video-inline {
  display: block;
  width: auto;
  height: auto;
  max-width: var(--chat-media-max-w, min(100%, 280px));
  max-height: var(--chat-media-max-h, min(42vh, 300px));
  object-fit: contain;
  border-radius: 0;
  margin-top: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.04);
  cursor: zoom-in;
}

:root[data-theme="dark"] .result-img-inline,
:root[data-theme="dark"] .result-video-inline {
  background: rgba(255, 255, 255, 0.04);
}

.result-video-inline {
  cursor: pointer;
}

.panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.panel.active {
  display: flex;
}

.panel h1 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 6px;
}

.panel .hint {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.chat-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 0;
  margin-bottom: 0;
  -webkit-overflow-scrolling: touch;
}

/* 对话区局部滚动：列表在 chat-scroll--local 内撑满并底对齐 */
.chat-scroll--local > .chat-messages-list {
  min-height: 100%;
  box-sizing: border-box;
}

.chat-main.has-chat .chat-scroll--local > .chat-messages-list::before {
  flex: 1 1 auto;
  min-height: 0;
}

.chat-scroll-top-btn {
  position: absolute;
  right: clamp(10px, 2.5vw, 22px);
  top: clamp(56px, 8vh, 72px);
  bottom: auto;
  z-index: 9;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(10px) scale(0.92);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.chat-scroll-top-btn:hover {
  background: rgba(91, 124, 250, 0.12);
  border-color: rgba(91, 124, 250, 0.45);
  color: var(--accent);
}

.chat-scroll-top-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chat-scroll-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

@media (max-width: 720px) {
  .chat-scroll-top-btn {
    top: clamp(48px, 7vh, 64px);
    width: 40px;
    height: 40px;
  }
}

/* 探索页输入框右下角已有发送按钮，不再显示回到顶部 */
.chat-main.is-inspiration .chat-scroll-top-btn {
  display: none;
}

.chat-messages-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
  min-height: 100%;
  box-sizing: border-box;
}

/* 有对话：顶部弹性占位把消息顶到底部；内容超出时仍可正常向上滚动 */
.chat-main.has-chat .chat-messages-list::before {
  content: '';
  flex: 1 1 auto;
  min-height: 0;
}

.chat-main:not(.has-chat) .msg-ai-welcome {
  display: none !important;
}

/* 有对话：标题区 + 可滚动对话 + 底部输入区 */
.chat-main.has-chat .chat-scroll {
  flex: 1 1 0;
  min-height: 0;
  max-height: none;
  margin-bottom: 0;
}

.chat-main.has-chat .err {
  margin: 0;
}

.chat-main.has-chat .composer-block {
  margin-top: 0;
  padding-top: 6px;
  flex-shrink: 0;
  overflow: visible;
  gap: 4px;
}

/* 共用排版；AI 像 DeepSeek 一样铺在背景上，不用独立灰底块圈住整段 */
.msg {
  line-height: 1.6;
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
  box-sizing: border-box;
}

.msg.user {
  align-self: flex-end;
  margin-left: auto;
  margin-right: 0;
  max-width: min(92%, 720px);
  width: -moz-fit-content;
  width: fit-content;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--bubble-user);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.msg.user .user-bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
  width: 100%;
}

.msg.user .user-attach-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 100%;
  width: 100%;
}

.msg.user .user-attach-preview-row:has(.user-attach-preview:only-child) .user-attach-preview {
  max-width: min(200px, 100%);
  max-height: 160px;
  width: auto;
  height: auto;
}

.msg.user .user-attach-preview {
  width: auto;
  height: auto;
  max-width: min(120px, 100%);
  max-height: 96px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: block;
  background: rgba(0, 0, 0, 0.04);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

:root[data-theme="dark"] .msg.user .user-attach-preview {
  background: rgba(255, 255, 255, 0.04);
}

.msg.user .user-attach-file-chip {
  display: inline-block;
  max-width: 240px;
  padding: 6px 10px;
  font-size: 0.78rem;
  line-height: 1.3;
  color: var(--text);
  background: rgba(91, 124, 250, 0.1);
  border: 1px solid var(--border);
  border-radius: 8px;
  word-break: break-word;
}

.msg.user .user-attach-file-link {
  text-decoration: none;
}

.msg.user .user-attach-file-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.msg.ai {
  align-self: flex-start;
  width: fit-content;
  max-width: min(92%, 720px);
  margin: 0;
  margin-right: auto;
  padding: 2px 0 12px;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--text);
  line-height: 1.65;
}

/* 一轮对话：用户输入靠右，AI 生成结果靠左（经典对话布局） */
.msg-turn {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  align-self: stretch;
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
  gap: 8px;
}

.msg-turn > .msg.user {
  align-self: flex-end;
  margin-left: auto;
  margin-right: 0;
  width: fit-content;
  max-width: min(92%, 720px);
}

.msg-turn > .msg.ai {
  align-self: flex-start;
  width: fit-content;
  max-width: min(92%, 720px);
  margin-left: 0;
  margin-right: auto;
}

.msg-turn > .msg.ai .ai-result-tools {
  justify-content: flex-start;
}

.msg-turn > .msg.ai[data-ai-loading='1'] {
  align-self: flex-start;
  width: auto;
  max-width: min(92%, 720px);
  margin: 0;
  margin-right: auto;
  padding: 0 0 4px;
}

.msg-turn-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-self: flex-end;
  width: fit-content;
  max-width: min(92%, 720px);
  margin-left: auto;
  margin-right: 0;
  padding: 4px 0 10px;
}

.msg-turn-act-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  line-height: 1.3;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.msg-turn-act-btn .btn-mini-ico {
  opacity: 0.88;
}

.msg-turn-act-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.msg-turn-act-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  color: var(--muted);
}

.msg-turn-act-btn--del:hover:not(:disabled) {
  border-color: #e5534b;
  color: #e5534b;
  background: color-mix(in srgb, #e5534b 8%, transparent);
}

.msg.ai[data-ai-loading='1'] {
  padding: 4px 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.chat-main.is-generation .msg.ai[data-ai-loading='1'] {
  align-self: flex-start;
  width: fit-content;
  max-width: min(92%, 720px);
  margin-left: 0;
  margin-right: auto;
}

.chat-main.is-generation .msg-turn > .msg.ai[data-ai-loading='1'] {
  align-self: flex-start;
  width: auto;
  margin-left: 0;
  margin-right: auto;
}

.ai-loading-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
}

.msg.ai[data-ai-loading='1']:has(.exec-cursor-step) .ai-loading-text {
  display: none;
}

.ai-loading-text {
  line-height: 1.5;
}

.exec-log-panel {
  margin-top: 8px;
  width: 100%;
  max-width: min(680px, 100%);
  max-height: none;
  overflow: visible;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.5;
}

.exec-log-panel--cursor {
  padding: 0;
}

.exec-log-cursor {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.exec-cursor-thought {
  margin: 0 0 2px;
  padding: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.exec-cursor-meta {
  margin: 0;
  padding: 0 0 0 20px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
}

.exec-cursor-meta--task {
  color: var(--text);
  opacity: 0.88;
  padding-left: 0;
  margin-bottom: 4px;
}

.exec-cursor-meta--summary {
  padding-left: 0;
  margin-top: 4px;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  opacity: 0.82;
}

.exec-cursor-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 1px 0;
  border: none;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.exec-cursor-step.is-active {
  border: none;
  background: none;
}

.exec-cursor-step--error .exec-cursor-step-text {
  color: #f87171;
}

.exec-cursor-step--done .exec-cursor-step-text {
  color: var(--muted);
}

.exec-cursor-step-ico {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-top: 3px;
  border-radius: 0;
  color: var(--muted);
  background: none;
  opacity: 0.72;
}

.exec-cursor-step--status.is-active .exec-cursor-step-ico {
  color: var(--accent);
  opacity: 1;
  animation: execLogDotPulse 1.2s ease-in-out infinite;
}

.exec-cursor-step--done .exec-cursor-step-ico,
.exec-cursor-step--action .exec-cursor-step-ico {
  color: var(--brand-green);
  opacity: 0.85;
}

.exec-cursor-step-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
  word-break: break-word;
}

.exec-cursor-step.is-active .exec-cursor-step-text {
  color: var(--text);
}

.exec-cursor-step--action .exec-cursor-step-text,
.exec-cursor-step--done .exec-cursor-step-text {
  color: var(--muted);
}

.exec-cursor-dots {
  display: inline-block;
  width: 0.95em;
  margin-left: 1px;
  vertical-align: baseline;
  animation: execLogBlink 1.1s ease-in-out infinite;
}

@keyframes execLogBlink {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}

@keyframes execLogDotPulse {
  0%, 100% { opacity: 0.45; transform: scale(0.88); }
  50% { opacity: 1; transform: scale(1); }
}

.exec-cursor-tools {
  flex-shrink: 0;
  align-self: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.68rem;
  color: var(--muted);
  opacity: 0.55;
  white-space: nowrap;
}

.exec-cursor-block--enter {
  animation: execLogBlockEnter 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.exec-cursor-step--pulse {
  animation: none;
}

@keyframes execLogBlockEnter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes execLogStatusPulse {
  0% { opacity: 0.65; }
  100% { opacity: 1; }
}

.chat-main.is-generation .exec-log-panel {
  max-height: none;
}

.chat-main.is-generation .msg.ai[data-ai-loading="1"] .ai-loading-row[hidden] {
  display: none !important;
}

.chat-main.is-generation .msg.ai[data-ai-loading="1"]:has(.exec-cursor-thought) .ai-loading-row {
  display: none;
}

/* legacy aliases */
.exec-log-lines {
  display: none;
}

.exec-log-line {
  display: none;
}

.ai-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: ai-spin 0.75s linear infinite;
}

@keyframes ai-spin {
  to {
    transform: rotate(360deg);
  }
}

/* 排队区：夹在对话与输入之间，与输入同宽，与输入框留出间距 */
.chat-queue-dock {
  flex-shrink: 0;
  width: 100%;
  max-width: min(800px, 100%);
  margin: 0 auto;
  padding: 10px 16px 14px;
  box-sizing: border-box;
}

.chat-main.is-generation .chat-queue-dock {
  padding: 8px 16px 12px;
  border-top: 1px solid rgba(37, 45, 61, 0.55);
  background: var(--bg);
  z-index: 2;
}

.chat-main.is-generation .chat-queue-dock:not(.is-hidden) {
  flex-shrink: 0;
}

.chat-main.is-generation .chat-queue-dock:not(.is-hidden) + .composer-block {
  padding-top: 2px;
}

.chat-main.is-generation .composer-block {
  flex-shrink: 0;
  margin-top: 0;
}

.chat-queue-dock.is-hidden {
  display: none !important;
}

.creation-queue {
  margin: 0;
  padding: 0;
  font-size: 0.84rem;
}

.creation-queue-cursor {
  margin: 0;
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
  box-sizing: border-box;
}

.creation-queue-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  list-style: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.creation-queue-summary::-webkit-details-marker,
.creation-queue-summary::marker {
  display: none;
  content: '';
}

.creation-queue-summary::before {
  content: '›';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-right: 2px;
  font-size: 0.95rem;
  line-height: 1;
  color: #9aa3b5;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.creation-queue-cursor[open] > .creation-queue-summary::before {
  transform: rotate(90deg);
}

.creation-queue-summary:hover {
  color: #b8beca;
}

.creation-queue-summary:hover::before {
  color: #c5cad6;
}

.creation-queue-summary-text {
  color: #c5cad6;
}

.creation-queue-cursor:not([open]) .creation-queue-list {
  display: none;
}

/* 超过 6 条时列表内滚动，避免占用过多创作区高度（对齐 Cursor 排队区） */
.creation-queue-list {
  --queue-row-h: 44px;
  margin: 0;
  padding: 0 4px 8px 8px;
  list-style: none;
  border-top: 1px solid rgba(37, 45, 61, 0.65);
  max-height: calc(var(--queue-row-h) * 6 + 4px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 147, 167, 0.55) transparent;
}

.creation-queue-list::-webkit-scrollbar {
  width: 8px;
}

.creation-queue-list::-webkit-scrollbar-track {
  background: transparent;
}

.creation-queue-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(139, 147, 167, 0.45);
}

.creation-queue-list::-webkit-scrollbar-thumb:hover {
  background: rgba(197, 202, 214, 0.55);
}

.creation-queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--queue-row-h);
  box-sizing: border-box;
  padding: 6px 6px;
  border-radius: 6px;
  transition: background 0.12s;
}

.creation-queue-item:hover {
  background: rgba(127, 127, 127, 0.08);
}

.creation-queue-ring {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(139, 147, 167, 0.75);
  box-sizing: border-box;
}

.creation-queue-title {
  flex: 1;
  min-width: 0;
  color: #d8dce6;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.creation-queue-actions {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  margin-left: auto;
}

.creation-queue-item.is-running .creation-queue-title {
  color: var(--muted);
}

.creation-queue-ring.is-spin {
  border: none;
  border-top: 1.5px solid var(--accent);
  border-right: 1.5px solid rgba(139, 147, 167, 0.35);
  border-bottom: 1.5px solid rgba(139, 147, 167, 0.35);
  border-left: 1.5px solid rgba(139, 147, 167, 0.35);
  animation: ai-spin 0.75s linear infinite;
}

.queue-act-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: #8b93a7;
  cursor: pointer;
  flex-shrink: 0;
}

.queue-act-btn:hover {
  background: rgba(127, 127, 127, 0.14);
  color: #e8ebf2;
}

.queue-act-btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
  opacity: 1;
}

.queue-act-btn svg {
  pointer-events: none;
}

.creation-queue-item.is-editing {
  background: rgba(91, 124, 250, 0.1);
}

.queue-edit-panel {
  margin: 0 8px 8px;
  padding: 10px 12px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(15, 18, 24, 0.92);
}

.queue-edit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.queue-edit-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.queue-edit-cancel {
  padding: 4px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}

.queue-edit-cancel:hover {
  color: var(--text);
  background: rgba(127, 127, 127, 0.12);
}

.queue-edit-input {
  display: block;
  width: 100%;
  min-height: 88px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f1218;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
}

.queue-edit-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(91, 124, 250, 0.22);
}

.queue-edit-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.queue-edit-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.queue-edit-save:hover {
  filter: brightness(1.08);
}

.queue-edit-save svg {
  pointer-events: none;
}

.composer-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 12px 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.composer-panel:has(.attach-thumbs.has-files) textarea {
  min-height: 36px;
}

.composer-toolbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  flex-shrink: 0;
  margin-top: 2px;
  padding: 0;
  background: transparent;
  border: none;
}

.composer-toolbar-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.composer-toolbar .model-dropdown {
  flex: 0 1 auto;
  min-width: 0;
}

.video-quality-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(127, 127, 127, 0.08);
  cursor: pointer;
  user-select: none;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.video-quality-wrap:hover {
  border-color: rgba(91, 124, 250, 0.35);
  color: var(--text);
}

.video-quality-wrap:has(.video-quality-check:checked) {
  border-color: rgba(91, 124, 250, 0.45);
  background: rgba(91, 124, 250, 0.1);
  color: var(--text);
}

.video-quality-wrap[hidden] {
  display: none !important;
}

.video-quality-check {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent, #3b82f6);
  cursor: pointer;
  flex-shrink: 0;
}

.video-quality-text {
  line-height: 1.2;
}

.composer-toolbar-left .model-dropdown + .video-quality-wrap {
  margin-left: 0;
}

.composer-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.composer-toolbar .btn-send {
  flex: 0 0 auto;
  margin-left: 0;
}

.model-pick select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
  padding: 0;
  border: none;
  appearance: none;
  z-index: 2;
}

.composer-panel textarea,
.field textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  max-height: 160px;
  resize: vertical;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.4;
  font-family: inherit;
  outline: none;
}

.btn {
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
}

/* 发送：输入框内圆形按钮 */
.composer-toolbar .btn-send {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.btn-send {
  flex: 0 0 auto;
  align-self: flex-end;
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: 10px;
  line-height: 1.25;
}

.btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
  cursor: pointer;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="file"],
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.9rem;
}

.result-img {
  margin-top: 20px;
  max-width: 100%;
  border-radius: 0;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.result-video {
  margin-top: 20px;
  max-width: 100%;
  border-radius: 0;
  border: 1px solid var(--border);
}

.err {
  color: #dc2626;
  font-size: 0.88rem;
  margin-top: 8px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.mode-context-hint {
  margin: 8px 0 4px;
  padding: 0 8px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.mode-context-hint:empty {
  display: none !important;
}

.link-context-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 6px 0 10px;
  padding: 0 8px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
  cursor: pointer;
}

.link-context-wrap input {
  margin-top: 2px;
  flex-shrink: 0;
}

.prompt-chips,
.animate-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  margin: 0;
  overflow: visible;
  min-width: 0;
  padding-bottom: 2px;
  position: relative;
  z-index: 2;
}

.prompt-chips-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.prompt-chips-more {
  position: relative;
  flex-shrink: 0;
  margin-left: auto;
  z-index: 60;
}

.prompt-chips-more-btn {
  flex-shrink: 0;
  font-size: 0.74rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px dashed var(--border);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.prompt-chips-more-btn:hover,
.prompt-chips-more-btn[aria-expanded='true'] {
  border-color: rgba(91, 124, 250, 0.55);
  color: var(--accent);
  background: rgba(91, 124, 250, 0.14);
  box-shadow: 0 0 0 3px rgba(91, 124, 250, 0.12);
}

body.is-prompt-chips-menu-open .works-feed-scroll,
body.is-prompt-chips-menu-open .composer-panel {
  z-index: 1;
}

body.is-prompt-chips-menu-open .composer-block {
  z-index: 40;
}

.prompt-chips-menu {
  position: fixed;
  z-index: 12000;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 6px;
  width: max-content;
  min-width: 112px;
  max-width: min(168px, calc(100vw - 24px));
  max-height: min(240px, 40vh);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 12px;
  border: 1px solid var(--chips-menu-border, rgba(255, 255, 255, 0.12));
  background: var(--chips-menu-bg, rgba(20, 22, 28, 0.97));
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: var(--chips-menu-shadow, 0 16px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(91, 124, 250, 0.1));
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(127, 127, 127, 0.45) transparent;
  animation: prompt-chips-menu-in 0.16s ease-out;
}

.prompt-chips-menu::before {
  content: '';
  position: absolute;
  top: 50%;
  left: -6px;
  width: 0;
  height: 0;
  margin-top: -6px;
  border: 6px solid transparent;
  border-right-color: var(--chips-menu-arrow, rgba(20, 22, 28, 0.97));
  filter: drop-shadow(-1px 0 0 var(--chips-menu-border, rgba(255, 255, 255, 0.06)));
  pointer-events: none;
}

.prompt-chips-menu.is-flip-left::before {
  left: auto;
  right: -6px;
  border-right-color: transparent;
  border-left-color: var(--chips-menu-arrow, rgba(20, 22, 28, 0.97));
  filter: drop-shadow(1px 0 0 var(--chips-menu-border, rgba(255, 255, 255, 0.06)));
}

@keyframes prompt-chips-menu-in {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.prompt-chips-menu.is-flip-left {
  animation-name: prompt-chips-menu-in-left;
}

@keyframes prompt-chips-menu-in-left {
  from {
    opacity: 0;
    transform: translateX(6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.prompt-chips-menu::-webkit-scrollbar {
  width: 5px;
}

.prompt-chips-menu::-webkit-scrollbar-thumb {
  background: rgba(127, 127, 127, 0.45);
  border-radius: 999px;
}

.prompt-chips-menu[hidden] {
  display: none !important;
}

.prompt-chips-menu .prompt-chip {
  width: 100%;
  max-width: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text);
  white-space: nowrap;
  box-shadow: none;
}

.prompt-chips-menu .prompt-chip:hover {
  background: var(--chips-menu-item-hover, rgba(91, 124, 250, 0.14));
  color: var(--text);
  border: none;
}

.prompt-chips-menu .prompt-chip--copy,
.prompt-chips-menu .prompt-chip--draw,
.prompt-chips-menu .prompt-chip--video,
.prompt-chips-menu .prompt-chip--doc,
.prompt-chips-menu .prompt-chip--code,
.prompt-chips-menu .prompt-chip--design {
  border: none;
  background: transparent;
}

.prompt-chips-menu .prompt-chip--copy:hover,
.prompt-chips-menu .prompt-chip--draw:hover,
.prompt-chips-menu .prompt-chip--video:hover,
.prompt-chips-menu .prompt-chip--doc:hover,
.prompt-chips-menu .prompt-chip--code:hover,
.prompt-chips-menu .prompt-chip--design:hover {
  background: var(--chips-menu-item-hover, rgba(91, 124, 250, 0.14));
}

:root[data-theme="light"] .prompt-chips-menu::-webkit-scrollbar-thumb {
  background: rgba(15, 17, 21, 0.18);
}

.animate-chips {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.prompt-chips::-webkit-scrollbar,
.animate-chips::-webkit-scrollbar {
  display: none;
  height: 0;
  width: 0;
}

.prompt-chips-label,
.animate-chips-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-right: 2px;
  flex-shrink: 0;
}

.prompt-chip,
.animate-chip {
  flex-shrink: 0;
  font-size: 0.74rem;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.prompt-chip--copy {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
}

.prompt-chip--draw {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
}

.prompt-chip--video {
  border-color: rgba(167, 139, 250, 0.4);
  background: rgba(167, 139, 250, 0.1);
}

.prompt-chip--doc {
  border-color: rgba(148, 163, 184, 0.45);
  background: rgba(148, 163, 184, 0.1);
}

.prompt-chip--upload {
  border-style: dashed;
}

.prompt-chip--work {
  border-style: dashed;
  border-color: rgba(91, 124, 250, 0.4);
}

.prompt-chip:hover,
.animate-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(91, 124, 250, 0.12);
}

/* —— 移动端：侧栏抽屉 + 输入区优先 —— */
.mobile-nav-backdrop,
.mobile-top-bar,
.mobile-fold-toggle,
.works-fold-caret {
  display: none;
}

@media (max-width: 720px) {
  .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 80;
    border: none;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .mobile-nav-backdrop:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
  }

  .app {
    position: relative;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  .app.is-mobile-nav-open {
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 90;
    width: min(88vw, 300px);
    max-width: 300px;
    max-height: none;
    height: 100%;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.28);
    border-right: 1px solid var(--border);
    border-bottom: none;
    padding: 14px 12px 16px;
  }

  .app.is-mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .brand {
    flex-shrink: 0;
    margin-bottom: 8px;
  }

  .provider-rail {
    flex: 1 1 auto;
    min-height: 0;
    margin-top: 0;
    overflow: hidden;
  }

  .provider-rail-list {
    max-height: none;
  }

  .sidebar-footer {
    flex-shrink: 0;
    border: none;
    border-top: 1px solid var(--border);
    margin-top: auto;
    padding: 10px 4px 4px;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .sidebar-theme-block {
    width: 100%;
    margin-bottom: 8px;
    padding-bottom: 8px;
  }

  .theme-picker-menu {
    left: 0;
    right: 0;
  }

  .sidebar-points {
    order: 1;
  }

  .sidebar-api-link {
    width: 100%;
    margin: 0;
  }

  .sidebar-auth-btn {
    width: 100%;
    margin-top: 0;
  }

  .main {
    flex: 1 1 auto;
    min-height: 0;
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 0 10px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .chat-main {
    min-height: 0;
    gap: 0;
  }

  .mobile-top-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 8px 2px 6px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 12;
  }

  .mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 6px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
  }

  .mobile-menu-btn svg {
    flex-shrink: 0;
  }

  .mobile-top-title {
    flex: 1;
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-top-points {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
  }

  .chat-scroll {
    flex: 1 1 0;
    min-height: 56px;
    margin-bottom: 0;
    padding: 6px 0 4px;
    -webkit-overflow-scrolling: touch;
  }

  .chat-hero-stage {
    padding: 8px 12px 4px;
  }

  .chat-main.has-chat .chat-hero-stage {
    padding: 4px 12px 0;
  }

  .chat-hero-title {
    font-size: clamp(1.2rem, 4.8vw, 1.5rem);
    line-height: 1.28;
  }

  .composer-block {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    margin-top: 0;
    gap: 4px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    padding-top: 6px;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
  }

  .composer-block .composer-bar {
    order: 1;
    flex-shrink: 0;
  }

  .works-feed-scroll {
    padding: 6px 12px max(8px, env(safe-area-inset-bottom));
  }

  .chat-main.has-chat .composer-block {
    padding-top: 6px;
  }

  .composer-panel {
    padding: 8px 12px 6px;
    border-radius: 16px;
  }

  .composer-panel textarea {
    min-height: 56px;
    max-height: min(32vh, 180px);
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .chat-main.is-inspiration .composer-panel {
    min-height: 104px;
    padding: 12px 14px 8px;
    border-radius: 18px;
  }

  .chat-main.is-inspiration .composer-panel textarea {
    min-height: 68px;
    max-height: min(28vh, 200px);
  }

  .chat-main.is-inspiration .works-feed-scroll {
    max-height: min(40vh, 380px);
    padding: 8px 12px 10px;
  }

  .chat-main.is-inspiration:not(.has-chat) .works-feed-scroll {
    flex: 0 0 auto;
    max-height: min(46vh, calc(100dvh - 300px));
  }

  .composer-intro-row--mobile {
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
  }

  .mobile-fold-toggle {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--muted);
    font-size: 0.78rem;
    cursor: pointer;
  }

  .mobile-fold-toggle[aria-expanded='true'] {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(91, 124, 250, 0.1);
  }

  .composer-intro-row--mobile .prompt-chips-panel {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    overflow: hidden;
  }

  .composer-intro-row--mobile .prompt-chips-panel.is-chips-menu-open {
    overflow: visible;
    z-index: 80;
  }

  .composer-intro-row--mobile .prompt-chips-panel.is-collapsed {
    display: none;
  }

  .composer-intro-row--mobile .prompt-chips-panel:not(.is-collapsed) {
    display: block;
  }

  .composer-intro-row--mobile .prompt-chips-panel:not(.is-collapsed)[hidden] {
    display: block;
  }

  .works-section--mobile-fold {
    margin-top: 0;
  }

  .works-section--mobile-peek {
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .works-section--mobile-peek:not(.works-section--below-input) .works-grid,
  .works-section--mobile-peek:not(.works-section--below-input) #works-grid {
    max-height: calc(var(--works-peek-visible) + 4px);
  }

  .works-section--mobile-peek .works-header {
    margin-bottom: 0;
    gap: 0;
  }

  .works-section--mobile-peek:not(.is-collapsed) .works-fold-body {
    display: block !important;
    margin-top: 6px;
  }

  .works-section--mobile-peek:not(.is-collapsed) .works-fold-body[hidden] {
    display: block !important;
  }

  .works-section--mobile-peek .works-header-actions {
    margin-bottom: 6px;
    gap: 6px;
  }

  .works-section--mobile-peek .works-search-wrap {
    flex: 1 1 100%;
    max-width: none;
    min-width: 0;
  }

  .works-section--mobile-peek .works-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 4px;
  }


  .works-section--mobile-peek .works-empty {
    padding: 12px 10px;
    font-size: 0.78rem;
  }

  .works-section--mobile-fold .works-header {
    margin-bottom: 0;
    gap: 0;
  }

  .works-fold-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: inherit;
    cursor: pointer;
    text-align: left;
  }

  .works-fold-toggle .works-heading {
    margin: 0;
    font-size: 0.92rem;
  }

  .works-fold-caret {
    display: block;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform 0.18s ease;
    flex-shrink: 0;
  }

  .works-section--mobile-fold:not(.is-collapsed) .works-fold-caret {
    transform: rotate(-135deg);
    margin-top: 4px;
  }

  .works-section--mobile-fold.is-collapsed .works-fold-body {
    display: none !important;
  }

  .works-section--mobile-fold:not(.is-collapsed) .works-fold-body {
    display: block;
    margin-top: 10px;
  }

  .works-section--mobile-fold:not(.is-collapsed) .works-fold-body[hidden] {
    display: block !important;
  }

  .works-section--mobile-fold.is-collapsed #works-grid,
  .works-section--mobile-fold.is-collapsed .works-empty {
    display: none;
  }

  .works-section--mobile-fold:not(.is-collapsed) .works-header {
    margin-bottom: 8px;
  }

  .works-section--mobile-fold:not(.is-collapsed) .works-fold-body .works-header-actions {
    margin-bottom: 10px;
  }

  .site-icp-bar {
    display: none;
  }

  .err {
    margin: 0 0 6px;
    font-size: 0.8rem;
  }
}

@media (min-width: 721px) {
  .chat-main.is-inspiration .composer-bar {
    max-width: min(800px, 100%);
    margin-left: auto;
    margin-right: auto;
  }

  .composer-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 0;
    flex-shrink: 0;
    border-top: none;
    padding-top: 6px;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
  }

  .composer-block .composer-bar {
    order: 1;
    flex-shrink: 0;
  }

  .chat-scroll {
    flex: 1 1 0;
    min-height: 0;
    margin-bottom: 0;
  }

  .chat-main.has-chat .composer-block .composer-bar {
    margin-top: 0;
  }

  .chat-main:not(.has-chat) .composer-block .composer-bar {
    margin-top: 8px;
  }

  .works-section--mobile-fold {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      'works-title works-actions'
      'works-gallery works-gallery';
    align-items: center;
    column-gap: 12px;
    row-gap: 10px;
  }

  .works-section--mobile-fold .works-fold-body[hidden] {
    display: contents !important;
  }

  .works-section--mobile-fold.is-collapsed #works-grid,
  .works-section--mobile-fold.is-collapsed .works-empty {
    display: revert;
  }

  .works-section--mobile-fold .works-header {
    grid-area: works-title;
    display: flex;
    align-items: center;
    margin-bottom: 0;
  }

  .works-section--mobile-fold > .works-header-actions,
  .works-section--mobile-fold .works-fold-body > .works-header-actions {
    grid-area: works-actions;
    margin-bottom: 0;
  }

  .works-section--mobile-fold #works-grid {
    grid-area: works-gallery;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .works-section--mobile-peek .works-header {
    margin-bottom: 4px;
  }

  .works-section--mobile-peek .works-header-actions {
    margin-bottom: 4px;
  }

  .works-section--mobile-peek:not(.works-section--below-input) .works-grid,
  .works-section--mobile-peek:not(.works-section--below-input) #works-grid {
    max-height: calc(var(--works-peek-visible) + 4px);
  }

  .works-section--mobile-fold .works-empty {
    grid-area: works-gallery;
  }

  .works-fold-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    border: none;
    background: none;
    cursor: default;
    width: auto;
    flex-shrink: 0;
  }

  .works-fold-toggle .works-heading {
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--text);
  }

  .works-fold-caret {
    display: none !important;
  }

  .works-fold-body {
    display: contents;
  }

  .works-fold-body[hidden] {
    display: contents !important;
  }

  .composer-intro-row--mobile .prompt-chips-panel {
    display: block !important;
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .composer-intro-row--mobile .prompt-chips-panel.is-chips-menu-open {
    overflow: visible;
    z-index: 80;
  }

  .composer-intro-row--mobile .prompt-chips {
    flex-wrap: nowrap;
    overflow: visible;
  }

  .composer-intro-row--mobile .prompt-chips-panel {
    display: block !important;
  }
}

/* 旧版整页登录（保留兼容；当前默认用弹窗 is-modal） */
html.login-gate,
html.login-gate body {
  min-height: 100%;
  background: #0f1117;
}

html.login-gate .app {
  display: none !important;
}

html.login-gate #login-overlay.login-overlay {
  display: flex !important;
}

/* seedclaude 登录 · 深色双栏（与锁标亮蓝同一气质） */
.login-overlay {
  --login-ds-bg: #0c0f14;
  --login-ds-panel: #141a24;
  --login-ds-border: #2a3348;
  --login-ds-accent: #38bdf8;
  --login-ds-accent-hover: #7dd3fc;
  --login-ds-accent-soft: rgba(56, 189, 248, 0.2);
  --login-ds-muted: #9aa8bf;
  --login-ds-text: #f1f5fb;

  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: max(28px, 5dvh) 16px 56px;
  overflow-y: auto;
  min-height: 100dvh;
  box-sizing: border-box;
  background:
    radial-gradient(100% 70% at 50% -10%, rgba(56, 189, 248, 0.12) 0%, transparent 55%),
    radial-gradient(120% 80% at 50% 0%, #151b28 0%, var(--login-ds-bg) 58%);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.login-overlay[hidden] {
  display: none !important;
}

/* 弹窗模式：背后主界面仍可见，可浏览历史作品 */
.login-overlay.is-modal {
  align-items: center;
  padding: 24px 16px;
  background: rgba(6, 8, 12, 0.62);
  backdrop-filter: blur(6px);
}

.login-overlay.is-modal .login-ds-shell {
  position: relative;
  width: min(920px, 100%);
  max-height: min(92dvh, 720px);
  overflow-y: auto;
  margin: auto;
  border-radius: 16px;
  border: 1px solid var(--login-ds-border);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.login-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--login-ds-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.login-modal-close:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--login-ds-text);
}

.login-ds-shell {
  width: 100%;
  max-width: 880px;
  margin-top: max(0px, env(safe-area-inset-top, 0px));
}

.login-ds-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}

.login-ds-lockup {
  width: min(280px, 86vw);
  max-width: 100%;
  height: auto;
  display: block;
  /* 透明底锁标叠在渐变上；轻微提亮以免发灰 */
  filter: brightness(1.08) saturate(1.12) contrast(1.03);
}

.login-ds-logo-sub {
  margin: 0;
  text-align: center;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #b8e7ff;
  text-shadow: 0 0 24px rgba(56, 189, 248, 0.25);
}

.login-ds-grid {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  gap: 40px;
}

.login-ds-col {
  min-width: 0;
}

.login-ds-form {
  flex: 1 1 320px;
  max-width: 400px;
}

.login-ds-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-ds-micro-hint {
  margin: 0 0 20px;
  font-size: 0.8rem;
  line-height: 1.58;
  color: #aab8d0;
}

.login-mode-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
}

.login-mode-tab {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--login-ds-border);
  background: transparent;
  color: #c5d0e6;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.login-mode-tab.is-active {
  border-color: #6ea8ff;
  background: rgba(110, 168, 255, 0.12);
  color: #fff;
}

.login-inline-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.login-field-block {
  margin-bottom: 14px;
}

.login-field-block .login-ds-field {
  margin-bottom: 0;
}

.login-ds-field {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  margin-bottom: 14px;
  padding: 4px 4px 4px 18px;
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid var(--login-ds-border);
  background: var(--login-ds-panel);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-ds-field:focus-within {
  border-color: var(--login-ds-accent);
  box-shadow: 0 0 0 2px var(--login-ds-accent-soft);
}

.login-ds-field.has-error,
.login-ds-field.has-error:focus-within {
  border-color: #ef4444;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35);
}

.login-field-err {
  margin: 6px 0 0 4px;
  font-size: 0.74rem;
  line-height: 1.35;
  color: #f87171;
}

.login-field-err:empty {
  display: none;
}

.login-cc {
  flex-shrink: 0;
  margin-right: 10px;
  font-size: 0.95rem;
  color: var(--login-ds-muted);
}

.login-phone-field,
.login-code-field {
  flex: 1 1 auto;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--login-ds-text);
  font-size: 0.95rem;
  outline: none;
  padding: 10px 12px 10px 0;
}

.login-phone-field::placeholder,
.login-code-field::placeholder {
  color: #6b7a92;
}

.login-ds-code-wrap {
  padding-right: 6px;
}

.login-code-divider {
  flex-shrink: 0;
  width: 1px;
  align-self: stretch;
  min-height: 28px;
  margin: 8px 4px 8px 0;
  background: var(--login-ds-border);
}

.login-send-link {
  flex-shrink: 0;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--login-ds-accent);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.login-send-link:hover:not(:disabled) {
  color: var(--login-ds-accent-hover);
}

.login-send-link:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.login-terms {
  margin: 4px 0 12px;
  font-size: 0.74rem;
  line-height: 1.55;
  color: #9babca;
}

.login-terms-link {
  color: var(--login-ds-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.login-terms-link:hover {
  color: var(--login-ds-accent-hover);
}

.login-overlay .login-msg {
  min-height: 1.25em;
  font-size: 0.82rem;
  color: #9eb1cc;
  margin: 0 0 14px;
}

.login-msg:empty {
  display: none;
}

.login-ds-submit {
  width: 100%;
  margin-top: 4px;
  padding: 14px 20px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 42%, #2563eb 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 8px 28px rgba(14, 165, 233, 0.28);
  transition: opacity 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.login-ds-submit:hover {
  filter: brightness(1.05);
  box-shadow: 0 10px 32px rgba(14, 165, 233, 0.38);
}

.login-ds-alt-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 22px;
  margin-bottom: 8px;
}

.login-ds-alt-line {
  flex: 1;
  max-width: 120px;
  height: 1px;
  background: var(--login-ds-border);
}

.login-ds-alt-ico {
  flex-shrink: 0;
  opacity: 0.55;
  color: #7dd3fc;
}

.login-ds-qr {
  flex: 0 0 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-qr-panel {
  width: 100%;
  max-width: 280px;
  padding: 26px 22px 22px;
  border-radius: 18px;
  background: linear-gradient(165deg, #162030 0%, var(--login-ds-panel) 100%);
  border: 1px solid rgba(56, 189, 248, 0.12);
  box-sizing: border-box;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.38);
}

.login-qr-box {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.login-wx-qr-wrap {
  width: 100%;
  max-width: 280px;
}

/* 否则 .login-wx-qr-frame{display:block} 会盖掉 [hidden]，未加载 iframe 时仍占 300px 白底 */
.login-wx-qr-frame[hidden] {
  display: none !important;
}

.login-wx-qr-frame {
  display: block;
  width: 100%;
  height: 300px;
  border: none;
  border-radius: 12px;
  background: #f8fafc;
}

.login-wx-err {
  margin: 10px 0 0;
  font-size: 0.74rem;
  line-height: 1.45;
  color: #fca5a5;
  text-align: center;
}

.login-wx-err:empty {
  display: none;
}

.login-wx-scope-hint {
  margin: 8px 0 0;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
  font-size: 0.68rem;
  line-height: 1.45;
  color: #64748b;
  text-align: center;
}

.login-wx-scope-hint code {
  font-size: 0.65rem;
  word-break: break-all;
}

.login-qr-placeholder {
  width: min(220px, 100%);
  min-height: 200px;
  aspect-ratio: 1;
  max-width: 220px;
  margin: 0 auto;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px dashed rgba(125, 211, 252, 0.28);
  color: #cbd5e1;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 14px;
  text-align: center;
  box-sizing: border-box;
}

.login-qr-ph-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e0f2fe;
}

.login-qr-ph-sub {
  font-size: 0.72rem;
  line-height: 1.45;
  color: #94a3b8;
}

.login-qr-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-size: 0.88rem;
  color: var(--login-ds-text);
}

.login-wechat-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #07c160;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .login-ds-grid {
    flex-direction: column;
    align-items: center;
    gap: 28px;
  }

  .login-ds-form {
    width: 100%;
    max-width: 400px;
  }

  .login-ds-qr {
    flex: 0 0 auto;
    width: 100%;
    max-width: 320px;
  }
}

@media (max-width: 480px) {
  .login-ds-qr {
    display: none;
  }

  .login-ds-grid {
    gap: 0;
  }
}

.btn-secondary {
  background: var(--sidebar);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn-text {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
}

.btn-text:hover {
  color: var(--accent);
}

.gate-panel {
  margin-top: 12px;
  padding: 10px 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.gate-panel .scene-label {
  margin-top: 0;
}

.gate-input {
  width: 100%;
  box-sizing: border-box;
  margin-top: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--sidebar);
  color: var(--text);
}

.gate-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.gate-save {
  font-size: 0.82rem;
  padding: 8px 12px;
}

/* —— 右侧对话历史（与左侧栏统一边框/底色，折叠为图标轨）—— */
:root {
  --history-width: 260px;
  --history-rail-width: 54px;
}

.history-panel {
  width: var(--history-width);
  flex-shrink: 0;
  align-self: stretch;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--sidebar);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
  transition: width 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-panel-inner {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  padding: 14px 12px 12px;
  overflow: hidden;
  box-sizing: border-box;
}

.history-panel-head {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  flex-shrink: 0;
  margin-bottom: 10px;
}

.history-chrome {
  display: inline-flex;
  align-self: flex-end;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
}

.history-chrome-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  flex-shrink: 0;
}

.history-chrome-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}

.history-chrome-btn:hover,
.history-chrome-btn.is-active {
  background: rgba(127, 127, 127, 0.14);
  color: var(--text);
}

:root[data-theme="light"] .history-chrome-btn:hover,
:root[data-theme="light"] .history-chrome-btn.is-active {
  background: rgba(0, 0, 0, 0.06);
}

.history-icon-expand {
  display: none;
}

.history-panel.history-panel--collapsed .history-icon-expand,
.app.history-panel-collapsed .history-icon-expand {
  display: block;
}

.history-panel.history-panel--collapsed .history-icon-collapse,
.app.history-panel-collapsed .history-icon-collapse {
  display: none;
}

.history-panel-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.history-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.history-tab {
  flex: 1 1 0;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.history-tab.is-active {
  color: var(--text);
  border-color: rgba(91, 124, 250, 0.45);
  background: rgba(91, 124, 250, 0.12);
}

.history-pane[hidden] {
  display: none !important;
}

.exec-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exec-history-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}

.exec-history-item--running {
  border-color: rgba(91, 124, 250, 0.45);
}

.exec-history-item--failed {
  border-color: rgba(248, 113, 113, 0.45);
}

.exec-history-summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 10px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px 8px;
  position: relative;
}

.exec-history-summary::-webkit-details-marker {
  display: none;
}

.exec-history-meta {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.exec-history-title {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}

.exec-history-jump {
  position: static;
  align-self: center;
  flex-shrink: 0;
  border: 1px solid rgba(91, 124, 250, 0.35);
  border-radius: 6px;
  background: rgba(91, 124, 250, 0.08);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 8px;
  white-space: nowrap;
}

.exec-history-jump:hover {
  text-decoration: underline;
}

.exec-history-logs {
  border-top: 1px solid var(--border);
  padding: 10px 10px 12px;
  max-height: 280px;
  overflow: auto;
}

.exec-history-logs.exec-log-cursor {
  gap: 8px;
}

.exec-history-log-line {
  display: none;
}

.exec-history-log-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.history-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.history-new-btn:hover {
  background: rgba(127, 127, 127, 0.12);
  border-color: rgba(127, 127, 127, 0.35);
}

:root[data-theme="light"] .history-new-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.history-new-btn-icon {
  display: flex;
  color: var(--muted);
}

.history-search-wrap {
  flex-shrink: 0;
  margin-bottom: 10px;
}

.history-search-wrap[hidden] {
  display: none !important;
}

.history-search {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px 8px 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg, #0d0d0f);
  color: var(--text);
  font-size: 0.82rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3 3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}

.history-search:focus {
  outline: none;
  border-color: rgba(91, 124, 250, 0.55);
  box-shadow: 0 0 0 2px rgba(91, 124, 250, 0.12);
}

.history-list-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(128, 128, 128, 0.45) transparent;
}

.history-list-scroll::-webkit-scrollbar {
  width: 6px;
}

.history-list-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.history-list-scroll::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.38);
  border-radius: 999px;
}

.history-list-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(128, 128, 128, 0.55);
}

.history-group {
  margin-bottom: 14px;
}

.history-group-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted, #8b949e);
  padding: 4px 8px 6px;
  text-transform: none;
}

.history-item-row {
  display: flex;
  align-items: stretch;
  gap: 2px;
  margin-bottom: 2px;
  border-radius: 10px;
  position: relative;
}

.history-item-row:hover,
.history-item-row.is-menu-open {
  background: rgba(127, 127, 127, 0.1);
}

:root[data-theme="light"] .history-item-row:hover,
:root[data-theme="light"] .history-item-row.is-menu-open {
  background: rgba(0, 0, 0, 0.05);
}

.history-item-row.is-active {
  background: rgba(91, 124, 250, 0.14);
  box-shadow: inset 0 0 0 1px rgba(91, 124, 250, 0.22);
}

.history-item-row.is-pinned .history-item-title::before {
  content: "★ ";
  font-size: 0.7rem;
  color: var(--muted);
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
  padding: 9px 4px 9px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease;
}

.history-item-row.is-active .history-item {
  font-weight: 500;
}

.history-item-more {
  flex-shrink: 0;
  width: 30px;
  margin: 4px 4px 4px 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  letter-spacing: 0.02em;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.history-item-row:hover .history-item-more,
.history-item-row.is-active .history-item-more,
.history-item-row.is-menu-open .history-item-more,
.history-item-more:focus-visible {
  opacity: 1;
}

.history-item-more:hover,
.history-item-row.is-menu-open .history-item-more {
  background: rgba(127, 127, 127, 0.16);
  color: var(--text);
}

@media (hover: none) {
  .history-item-more {
    opacity: 0.65;
  }

  .history-item-row.is-active .history-item-more {
    opacity: 1;
  }
}

.history-session-menu {
  position: fixed;
  z-index: 200;
  min-width: 148px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.history-session-menu[hidden] {
  display: none !important;
}

.history-session-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.history-session-menu-item:hover {
  background: rgba(127, 127, 127, 0.12);
}

:root[data-theme="light"] .history-session-menu-item:hover {
  background: rgba(0, 0, 0, 0.06);
}

.history-session-menu-item--danger {
  color: #f87171;
}

.history-session-menu-item--danger:hover {
  background: rgba(248, 113, 113, 0.12);
}

.history-session-menu-ico {
  display: flex;
  flex-shrink: 0;
  opacity: 0.88;
}

.history-session-menu-item--danger .history-session-menu-ico {
  color: #f87171;
}

.history-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 0.84rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.history-toast.is-visible {
  opacity: 1;
}

.history-item-kind {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  opacity: 0.75;
  background: rgba(128, 128, 128, 0.12);
}

.history-item-kind--video {
  color: #a78bfa;
}

.history-item-kind--draw {
  color: #34d399;
}

.history-item-kind--copy {
  color: #60a5fa;
}

.history-item-kind--exec {
  color: #fbbf24;
  font-size: 0.58rem;
}

.exec-history-meta--failed {
  color: #f87171;
  font-weight: 600;
}

.exec-history-meta--running {
  color: #60a5fa;
}

.exec-history-meta--done {
  color: var(--muted);
}

.history-session-block {
  margin-bottom: 4px;
}

.history-session-block.has-execs {
  border-radius: 10px;
  background: rgba(128, 128, 128, 0.04);
}

:root[data-theme="light"] .history-session-block.has-execs {
  background: rgba(0, 0, 0, 0.02);
}

.history-session-block.has-execs .history-item-row {
  margin-bottom: 0;
}

.history-session-block.is-collapsed .history-session-execs {
  display: none;
}

.history-session-fold {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  margin: 6px 0 6px 4px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, background 0.14s ease, color 0.14s ease;
}

.history-item-row:has(.history-session-fold) .history-item {
  padding-left: 4px;
}

.history-session-fold:hover,
.history-session-fold:focus-visible {
  background: rgba(127, 127, 127, 0.14);
  color: var(--accent);
}

.history-session-block.is-collapsed .history-session-fold svg {
  transform: rotate(-90deg);
}

.history-session-execs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 6px 8px 14px;
  border-left: 2px solid rgba(91, 124, 250, 0.22);
  margin: 0 8px 0 18px;
}

.history-session-exec-badge {
  flex-shrink: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(91, 124, 250, 0.16);
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.history-exec-row {
  margin-bottom: 0;
}

.history-exec-row .exec-history-summary {
  grid-template-columns: 18px minmax(0, 1fr);
  padding: 6px 8px;
}

.history-exec-row--nested {
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
}

.history-exec-row--nested.exec-history-item--failed {
  border-color: rgba(248, 113, 113, 0.25);
  background: rgba(248, 113, 113, 0.06);
}

.history-exec-row--nested.exec-history-item--done {
  border-color: rgba(128, 128, 128, 0.12);
}

.history-exec-row .history-item-title-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  grid-column: 2;
}

.history-exec-row .history-item-kind {
  grid-column: 1;
  grid-row: 1;
}

.history-exec-row .exec-history-jump {
  grid-column: 3;
  grid-row: 1;
}

.history-exec-row .history-item-title,
.history-exec-row .exec-history-title {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 12px;
}

.history-mobile-backdrop {
  display: none;
}

/* 折叠：保留窄图标轨（参考 DeepSeek，纵向排列） */
.app.history-panel-collapsed .history-panel {
  width: var(--history-rail-width);
  opacity: 1;
  pointer-events: auto;
  overflow: hidden;
}

.app.history-panel-collapsed .history-panel-inner {
  padding: 12px 6px;
  align-items: center;
}

.app.history-panel-collapsed .history-panel-head {
  margin-bottom: 0;
  width: 100%;
  align-items: center;
}

.app.history-panel-collapsed .history-chrome {
  flex-direction: column;
  align-self: center;
  width: 100%;
  padding: 5px 3px;
  border-radius: 14px;
}

.app.history-panel-collapsed .history-chrome-sep {
  width: 20px;
  height: 1px;
}

.app.history-panel-collapsed .history-new-btn,
.app.history-panel-collapsed .history-panel-body {
  display: none !important;
}

@media (max-width: 720px) {
  .mobile-history-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
  }

  .mobile-history-btn:active {
    background: rgba(128, 128, 128, 0.15);
  }

  .history-mobile-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 85;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  .history-mobile-backdrop:not([hidden]) {
    opacity: 1;
    pointer-events: auto;
  }

  .history-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 88;
    width: min(88vw, 300px);
    max-width: 300px;
    transform: translateX(105%);
    transition: transform 0.24s ease;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.25);
  }

  .app.is-history-mobile-open .history-panel {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
    width: min(88vw, 300px);
    min-width: unset;
  }

  .app.is-history-mobile-open.history-panel-collapsed .history-panel {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .app.history-panel-collapsed:not(.is-history-mobile-open) .history-panel {
    transform: translateX(105%);
  }

}

@media (min-width: 721px) {
  .mobile-history-btn {
    display: none;
  }
}

/* 应用内确认 / 输入弹窗（替代 window.confirm / prompt） */
.app-dialog {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

.app-dialog[hidden] {
  display: none !important;
}

.app-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(4px);
}

.app-dialog-card {
  position: relative;
  width: min(100%, 400px);
  padding: 22px 22px 18px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.app-dialog-title {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.app-dialog-message {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
  word-break: break-word;
}

.app-dialog-message[hidden] {
  display: none;
}

.app-dialog-input {
  display: block;
  width: 100%;
  margin: 0 0 18px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.app-dialog-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 124, 250, 0.22);
}

.app-dialog-input[hidden] {
  display: none;
}

.app-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.app-dialog-btn {
  min-width: 84px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.app-dialog-btn--ghost {
  color: var(--text);
  background: transparent;
  border-color: var(--border);
}

.app-dialog-btn--ghost:hover {
  background: rgba(128, 128, 128, 0.12);
}

.app-dialog-btn--primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.app-dialog-btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.app-dialog-btn--danger {
  background: #e5484d;
  border-color: #e5484d;
}

.app-dialog-btn--danger:hover {
  background: #f2555a;
  border-color: #f2555a;
}

body.is-app-dialog-open {
  overflow: hidden;
}

/* 桌面 IDE 内嵌：隐藏「下载桌面版」入口，其余与网页版一致 */
html.embed-desktop .sidebar-api-link--desktop {
  display: none !important;
}
