:root {
  color-scheme: dark;
  --bg: #0c0d10;
  --panel: #121419;
  --panel-2: #191c23;
  --line: #292d36;
  --text: #eef0f4;
  --muted: #9299a8;
  --accent: #8b7cf6;
  --accent-2: #6252d8;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  overflow: hidden;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
button,
input,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
.hidden {
  display: none !important;
}
.muted {
  color: var(--muted);
}
.error {
  color: #ff8484;
  min-height: 1.3em;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 20%, #24213c 0, var(--bg) 42%);
}
.login-card {
  width: min(390px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(18, 20, 25, 0.92);
  box-shadow: 0 24px 80px #0008;
}
.login-card h1 {
  margin: 16px 0 0;
  text-align: center;
}
.login-card > p {
  text-align: center;
}
.login-card label {
  display: grid;
  gap: 7px;
  margin: 18px 0;
  color: #c7cbd5;
  font-size: 14px;
}
.login-card input {
  width: 100%;
  padding: 12px 14px;
  color: var(--text);
  background: #0d0f13;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.login-card input:focus {
  border-color: var(--accent);
}
.login-card button,
.new-chat {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 12px;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 700;
}
.login-card .demo {
  font-size: 12px;
  color: var(--muted);
}
.login-card.loading > p {
  margin: 6px 0 0;
}
.login-card.loading h1 {
  margin-top: 18px;
}
.spinner {
  margin: 22px auto 4px;
  width: 30px;
  height: 30px;
  border: 3px solid #ffffff20;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.brand-mark {
  margin: auto;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: white;
  background: linear-gradient(135deg, #a99dfb, #5948cf);
  font:
    700 34px Georgia,
    serif;
  box-shadow: 0 10px 32px #7867ee55;
}
.brand-mark.small {
  width: 48px;
  height: 48px;
  font-size: 28px;
  border-radius: 14px;
}

.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 310px;
  overflow: hidden;
}
.sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 18px 12px 12px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}
.brand {
  padding: 4px 10px 20px;
  font-weight: 750;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  border-radius: 8px;
  background: var(--accent-2);
  font-family: Georgia, serif;
}
.brand-logo {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 8px;
  display: block;
}
.brand-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.25;
}
.brand-title {
  font-size: 16px;
  font-weight: 750;
}
.brand-sub {
  display: block;
  max-width: 100%;
  overflow: hidden;
  /* color: var(--muted); */
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.brand-sub:empty {
  display: none;
}
.login-logo {
  width: 58px;
  height: 58px;
  margin: 0 auto;
  border-radius: 17px;
}
.new-chat {
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-weight: 600;
}
.conversation-list {
  flex: 1;
  overflow: auto;
  margin: 16px 0;
}
.conversation {
  position: relative;
  width: 100%;
  padding: 11px 26px 11px 12px;
  overflow: hidden;
  color: #b9bfca;
  background: transparent;
  border: 0;
  border-radius: 9px;
  text-align: left;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.conversation:hover,
.conversation.active {
  color: white;
  background: var(--panel-2);
}
.conversation:hover .conversation-remove {
  display: grid;
}
.conversation:hover .conversation-remove {
  width: 20px;
  height: 20px;
}
.profile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 9px 4px;
  border-top: 1px solid var(--line);
}
.profile small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}
.ghost {
  color: var(--muted);
  background: transparent;
  border: 0;
}

.chat {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: 67px minmax(0, 1fr) auto;
  overflow: hidden;
}
.chat header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: #0c0d10dd;
  backdrop-filter: blur(12px);
}
.chat header h2 {
  max-width: 50vw;
  margin: 0;
  overflow: hidden;
  font-size: 16px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.chat header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.status {
  padding: 5px 9px;
  color: #8cdbb4;
  background: #153126;
  border-radius: 999px;
  font-size: 11px;
}
.status.busy {
  color: #d7ceff;
  background: #29234c;
}
.mobile-menu {
  display: none;
  color: white;
  background: none;
  border: 0;
  font-size: 20px;
}
.messages {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 34px max(24px, calc((100% - 820px) / 2));
  /* 流式输出由 JS 每帧贴底接管：禁用平滑滚动（动画追赶中内容收缩会停在半路，
     丢失贴底跟随）与滚动锚定（每帧 innerHTML 重建会破坏锚点导致视口上跳） */
  scroll-behavior: auto;
  overflow-anchor: none;
}
.welcome {
  margin-top: 14vh;
  text-align: center;
  color: var(--muted);
}
.welcome h2 {
  color: var(--text);
}
.message {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 13px;
  margin: 22px 0;
  line-height: 1.65;
}
.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: white;
  background: #2a2e38;
  font-size: 13px;
  font-weight: 700;
}
.message.assistant .avatar {
  background: var(--accent-2);
  font:
    700 20px Georgia,
    serif;
}
.message .message-body {
  min-width: 0;
}
.message .content {
  min-width: 0;
  padding-top: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message .content:has(p, h1, h2, h3, ul, ol, pre, blockquote, img, table) {
  white-space: normal;
}
.message .content > :first-child {
  margin-top: 0;
}
.message .content > :last-child {
  margin-bottom: 0;
}
.message .content p {
  margin: 0.55em 0;
}
.message .content h1,
.message .content h2,
.message .content h3,
.message .content h4 {
  margin: 0.85em 0 0.35em;
  line-height: 1.35;
  font-weight: 700;
  color: inherit;
}
.message .content h1 {
  font-size: 1.25em;
}
.message .content h2 {
  font-size: 1.15em;
}
.message .content h3 {
  font-size: 1.05em;
}
.message .content ul,
.message .content ol {
  margin: 0.45em 0;
  padding-left: 1.35em;
}
.message .content li {
  margin: 0.2em 0;
}
.message .content hr {
  border: 0;
  border-top: 1px solid rgba(92, 67, 207, 0.18);
  margin: 0.9em 0;
}
.message .content strong {
  font-weight: 700;
}
.message .content a {
  color: #5c43cf;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.message .content img {
  display: block;
  max-width: min(100%, 260px);
  width: auto;
  height: auto;
  margin: 0.65em 0;
  border-radius: 12px;
  background: #0b0c0f;
}
.message .content code {
  padding: 0.1em 0.35em;
  border-radius: 5px;
  background: rgba(118, 89, 233, 0.1);
  font:
    0.92em/1.5 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
}
.message .content pre {
  margin: 0.65em 0;
  padding: 10px 12px;
  overflow: auto;
  border-radius: 10px;
  background: rgba(18, 16, 28, 0.06);
}
.message .content pre code {
  padding: 0;
  background: transparent;
}
.message .content blockquote {
  margin: 0.55em 0;
  padding: 0.15em 0 0.15em 0.85em;
  border-left: 3px solid rgba(92, 67, 207, 0.35);
  color: #5a5470;
}
.message.user .content {
  color: #f4f4f6;
}
.message.error .content {
  color: #ff9a9a;
}
.thinking-box {
  margin: 0 0 10px;
  border: 1px solid #34304b;
  border-radius: 10px;
  overflow: hidden;
  background: #151420;
}
.thinking-box summary {
  padding: 8px 11px;
  color: #aaa1e7;
  cursor: pointer;
  font-size: 12px;
  user-select: none;
}
.thinking-box pre {
  max-height: 280px;
  margin: 0;
  padding: 0 11px 11px;
  overflow: auto;
  color: #aaaeb9;
  font:
    12px/1.6 ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 9px;
}
.skill-tag {
  padding: 3px 7px;
  border: 1px solid #3c3761;
  border-radius: 999px;
  color: #b8aff7;
  background: #211e38;
  font-size: 11px;
}
.artifact-card {
  margin: 20px 0 26px 47px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
}
.artifact-card img {
  display: block;
  width: 100%;
  max-height: 620px;
  object-fit: contain;
  background: #090a0d;
}
.artifact-card video {
  display: block;
  width: 100%;
  max-height: 620px;
  background: #090a0d;
}
.pending-video-box {
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 40px 20px;
}
.pending-video-spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid #2c3140;
  border-top-color: #7c6ff0;
  animation: pending-video-spin 1s linear infinite;
}
.pending-video-status {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
@keyframes pending-video-spin {
  to {
    transform: rotate(360deg);
  }
}
.artifact-placeholder {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #0b0c0f;
}
.artifact-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}
.artifact-meta strong {
  display: block;
  font-size: 13px;
}
.artifact-meta small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}
.artifact-actions {
  display: flex;
  gap: 7px;
}
.artifact-actions a {
  padding: 6px 9px;
  color: #d9d4ff;
  border: 1px solid #413b68;
  border-radius: 7px;
  text-decoration: none;
  font-size: 11px;
}
.artifact-prompt {
  margin: 0;
  padding: 0 14px 13px;
  color: #8d94a2;
  font-size: 11px;
  line-height: 1.5;
}
.cursor::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 16px;
  margin-left: 3px;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 0.8s infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* 欢迎会话预热占位：agent 正在生成首条邀约消息时的等待动画 */
.welcome-waiting {
  display: grid;
  place-items: center;
  gap: 14px;
  margin-top: 18vh;
  text-align: center;
  color: var(--muted);
}
.welcome-waiting .pending-video-spinner {
  width: 30px;
  height: 30px;
}
.welcome-waiting h2 {
  color: var(--text);
}
.welcome-waiting p {
  margin: 0;
  font-size: 13px;
}

/* 会话列表删除按钮：hover 时才浮现，不挤占标题点击区 */
.conversation-remove {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: none;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 6px;
  color: #a7adba;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.conversation-remove:hover {
  color: #ff9a9a;
  background: #2a2536;
}

/* 后台会话运行中/观察中标记：脉冲绿点（切走仍输出，切回可续看） */
.conversation-live {
  position: absolute;
  top: 50%;
  right: 32px;
  width: 7px;
  height: 7px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #58d68d;
  box-shadow: 0 0 6px rgba(88, 214, 141, 0.9);
  animation: conversation-live-pulse 1.4s ease-in-out infinite;
  pointer-events: none;
}
.conversation-live[title="另一窗口对话中"] {
  background: #7aa2f7;
  box-shadow: 0 0 6px rgba(122, 162, 247, 0.9);
}
@keyframes conversation-live-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.composer-wrap {
  padding: 12px max(24px, calc((100% - 820px) / 2)) 20px;
  background: linear-gradient(transparent, var(--bg) 25%);
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-2);
  box-shadow: 0 12px 30px #0004;
}
.composer:focus-within {
  border-color: #4f496d;
}
.composer textarea {
  flex: 1;
  max-height: 180px;
  resize: none;
  padding: 7px 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  line-height: 1.5;
}
.composer button {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 10px;
  color: white;
  background: var(--accent-2);
  font-size: 20px;
}
#sendButton {
  background: linear-gradient(135deg, #8e72ff 0%, #6547e7 100%);
}
.composer .stop {
  background: #414652;
  font-size: 13px;
}
.composer-wrap > small {
  display: block;
  margin-top: 8px;
  color: #626976;
  text-align: center;
}

.trace-panel {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #101217;
  border-left: 1px solid var(--line);
}
.trace-header {
  min-height: 67px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}
.trace-header small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}
.skill-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}
.skill-legend span {
  width: 100%;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.skill-legend code {
  padding: 3px 6px;
  color: #aaa1e7;
  background: #211e38;
  border-radius: 5px;
  font-size: 10px;
}
.trace-list {
  min-height: 0;
  flex: 1;
  padding: 16px 14px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.trace-empty {
  padding: 18px 10px;
  color: #676e7c;
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}
.trace-item {
  position: relative;
  margin-left: 7px;
  padding: 0 0 20px 18px;
  border-left: 1px solid #343844;
}
.trace-item::before {
  content: "";
  position: absolute;
  top: 4px;
  left: -5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #596070;
  box-shadow: 0 0 0 3px #101217;
}
.trace-item.skill::before {
  background: var(--accent);
}
.trace-item.image::before {
  background: #55a9e6;
}
.trace-item.thinking::before {
  background: #d29b58;
}
.trace-item.done::before {
  background: #54bb87;
}
.trace-item.error::before {
  background: #ec6f6f;
}
.trace-item strong {
  display: block;
  color: #d8dbe2;
  font-size: 12px;
}
.trace-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.trace-item time {
  display: block;
  margin-top: 5px;
  color: #555c69;
  font-size: 10px;
}

@media (max-width: 1080px) {
  .app {
    grid-template-columns: 230px minmax(0, 1fr);
  }
  .trace-panel {
    display: none;
  }
}

@media (max-width: 720px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    z-index: 5;
    inset: 0 auto 0 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.2s;
    box-shadow: 20px 0 60px #0009;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-menu {
    display: block;
  }
  .chat header {
    padding: 0 14px;
    justify-content: flex-start;
    gap: 12px;
  }
  .chat header .status {
    margin-left: auto;
  }
  .messages {
    padding: 22px 16px;
  }
  .composer-wrap {
    padding: 10px 12px 14px;
  }
}

.upload-button {
  background: #414652 !important;
  font-size: 16px !important;
}
.upload-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.upload-icon {
  display: block;
  width: 20px;
  height: 21px;
  background-color: currentColor;
  -webkit-mask: url("/assets/midautumn/attachment.svg") center / contain
    no-repeat;
  mask: url("/assets/midautumn/attachment.svg") center / contain no-repeat;
}
body:not(.theme-midautumn) .upload-icon {
  display: none;
}
body:not(.theme-midautumn) .upload-button::after {
  content: "📎";
}

.pending-uploads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
  padding: 0 max(24px, calc((100% - 820px) / 2));
}
.pending-upload-chip {
  position: relative;
  display: inline-block;
}
.pending-upload-chip img {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.pending-upload-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #9aa0aa;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
}
.pending-upload-remove:hover {
  color: #e0e3e8;
  background: #41465266;
}

/* ---- Mid-Autumn festival overlay (remove body.theme-midautumn to disable) ---- */
body.theme-midautumn {
  --bg: #1a1528;
  --panel: rgba(18, 16, 28, 0.55);
  --panel-2: rgba(28, 24, 42, 0.72);
  --line: rgba(255, 220, 180, 0.18);
  --text: #f7f2ea;
  --muted: #c4b8d4;
  --accent: #e8b86d;
  --accent-2: #c48a3a;
  background-color: var(--bg);
  background-image: url("/assets/midautumn/bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body.theme-midautumn .login-shell {
  background:
    linear-gradient(180deg, rgba(20, 16, 32, 0.35), rgba(20, 16, 32, 0.55)),
    url("/assets/midautumn/bg.jpg") center / cover no-repeat;
}

body.theme-midautumn .login-card {
  background: rgba(18, 16, 28, 0.78);
  border-color: rgba(255, 220, 180, 0.22);
  backdrop-filter: blur(14px);
}

body.theme-midautumn .login-card .spinner {
  border-color: rgba(92, 67, 207, 0.2);
  border-top-color: #5c43cf;
}

body.theme-midautumn .login-card #loginError {
  color: #5c43cf;
}

body.theme-midautumn .app {
  background: transparent;
}

body.theme-midautumn .chat {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.27) 0%,
    rgba(255, 255, 255, 0.8) 100%
  );
  color: #2a2438;
}

body.theme-midautumn .brand-title {
  color: #2a2118;
}
body.theme-midautumn .brand-sub {
  color: #7a6a58;
}
body.theme-midautumn .sidebar {
  background: rgba(255, 255, 255, 0.42);
  border-right-color: rgba(117, 105, 166, 0.04);
  color: #2a2438;
}

body.theme-midautumn .sidebar .conversation {
  font-size: 16px;
  color: #303048;
  font-weight: 500;
}

body.theme-midautumn .sidebar .conversation:hover {
  color: #303048;
  background: rgba(130, 100, 250, 0.08);
}

body.theme-midautumn .sidebar .conversation.active {
  background: rgba(130, 100, 250, 0.15);
  font-weight: 600;
  font-size: 16px;
  color: #5c43cf;
}

body.theme-midautumn .sidebar .profile {
  border-top-color: rgba(42, 36, 56, 0.12);
  padding: 24px 9px 16px;
}

body.theme-midautumn .sidebar .profile small {
  color: #6a6280;
}

body.theme-midautumn #userId,
body.theme-midautumn #logout {
  display: none;
}

body.theme-midautumn .chat header {
  background: transparent;
  border-bottom: 1px solid rgba(117, 105, 166, 0.04);
  backdrop-filter: none;
  color: #2a2438;
}

body.theme-midautumn .chat header h2 {
  color: #1f1a2e;
}

body.theme-midautumn .chat header p {
  color: #6a6280;
}

body.theme-midautumn .chat header .mobile-menu {
  color: #2a2438;
}

body.theme-midautumn .composer-wrap {
  background: transparent;
  padding-bottom: 32px;
}

body.theme-midautumn .composer {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(116, 95, 226, 0.16);
  box-shadow: none;
  backdrop-filter: none;
}

body.theme-midautumn .composer textarea {
  color: #2a2438;
}

body.theme-midautumn .composer textarea::placeholder {
  color: #8f90a3;
}

body.theme-midautumn .composer-wrap > small {
  color: #6a6280;
}

body.theme-midautumn .trace-panel {
  background: rgba(255, 255, 255, 0.78);
  border-left-color: rgba(117, 105, 166, 0.04);
  color: #2a2438;
}

body.theme-midautumn .trace-panel .trace-header,
body.theme-midautumn .trace-panel .skill-legend {
  border-bottom-color: rgba(42, 36, 56, 0.12);
}

body.theme-midautumn .trace-panel .trace-header small,
body.theme-midautumn .trace-panel .skill-legend span,
body.theme-midautumn .trace-panel .trace-empty,
body.theme-midautumn .trace-panel .trace-item p,
body.theme-midautumn .trace-panel .trace-item time {
  color: #6a6280;
}

body.theme-midautumn #clearTrace {
  font-weight: 500;
  font-size: 14px;
  color: #684be0;
}

body.theme-midautumn .trace-panel .trace-item strong {
  color: #2a2438;
}

body.theme-midautumn .trace-panel .skill-legend code {
  background: rgba(118, 89, 233, 0.09);
  font-size: 11px;
  color: #6348c7;
}

body.theme-midautumn .trace-item {
  border-left-color: rgba(42, 36, 56, 0.16);
}

body.theme-midautumn .trace-item::before {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9);
}

body.theme-midautumn .welcome {
  margin-top: 28vh;
  display: grid;
  justify-items: center;
}

body.theme-midautumn .messages.is-empty {
  background-image: url("/assets/midautumn/moon.png");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
}

body.theme-midautumn .welcome h2 {
  color: #1f1a2e;
  text-shadow: none;
}

body.theme-midautumn .welcome p {
  color: #6a6280;
  text-shadow: none;
  margin-top: 2px;
}

body.theme-midautumn .message.user .content,
body.theme-midautumn .message .content {
  color: #2a2438;
}

body.theme-midautumn .message.error .content {
  color: #b42318;
}

body.theme-midautumn .message .content img {
  background: #fff;
  border: 1px solid rgba(117, 105, 166, 0.12);
}

body.theme-midautumn .message .content hr {
  border-top-color: rgba(117, 105, 166, 0.16);
}

body.theme-midautumn .message .content pre {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(117, 105, 166, 0.12);
}

body.theme-midautumn .message .content blockquote {
  color: #5a5470;
  border-left-color: rgba(92, 67, 207, 0.35);
}

body.theme-midautumn .avatar {
  background: rgba(130, 100, 250, 0.15);
  color: #5c43cf;
}

body.theme-midautumn .thinking-box {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(117, 105, 166, 0.14);
}

body.theme-midautumn .thinking-box summary {
  color: #5c43cf;
}

body.theme-midautumn .thinking-box pre {
  color: #4a435c;
}

body.theme-midautumn .skill-tag {
  color: #6348c7;
  background: rgba(118, 89, 233, 0.09);
  border-color: rgba(118, 89, 233, 0.16);
}

body.theme-midautumn .artifact-card {
  background: #fff;
  border-color: rgba(117, 105, 166, 0.14);
  box-shadow: 0 8px 24px rgba(92, 67, 207, 0.06);
}

body.theme-midautumn .artifact-card img,
body.theme-midautumn .artifact-card video {
  background: #fff;
}

body.theme-midautumn .artifact-placeholder {
  background: rgba(255, 255, 255, 0.9);
  color: #6a6280;
}

body.theme-midautumn .artifact-meta strong {
  color: #2a2438;
}

body.theme-midautumn .artifact-meta small,
body.theme-midautumn .artifact-prompt {
  color: #6a6280;
}

body.theme-midautumn .artifact-actions a {
  color: #5c43cf;
  border-color: rgba(92, 67, 207, 0.22);
  background: rgba(130, 100, 250, 0.08);
}

body.theme-midautumn .pending-video-spinner {
  border-color: rgba(92, 67, 207, 0.18);
  border-top-color: #5c43cf;
}

body.theme-midautumn .pending-video-status {
  color: #6a6280;
}

body.theme-midautumn .message.assistant .avatar {
  background: transparent;
  padding: 0;
  overflow: hidden;
}

body.theme-midautumn .message.assistant .avatar-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.theme-midautumn .status {
  background: rgba(77, 183, 126, 0.16);
  font-weight: 600;
  font-size: 12px;
  color: #28734f;
}

body.theme-midautumn .status.busy {
  color: #5c43cf;
  background: rgba(92, 67, 207, 0.2);
}

body.theme-midautumn .cursor::after {
  background: #5c43cf;
}

body.theme-midautumn .new-chat {
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(108, 98, 166, 0.14);
  font-weight: 600;
  font-size: 16px;
  color: #17172b;
}

body.theme-midautumn .upload-button {
  background: transparent !important;
  color: #8f90a3;
}

body.theme-midautumn .upload-button:hover:not(:disabled) {
  background: rgba(130, 100, 250, 0.15) !important;
  color: #5c43cf;
}

/* Soft scrollbars for left / middle / right panes — transparent track */
body.theme-midautumn .conversation-list,
body.theme-midautumn .messages,
body.theme-midautumn .trace-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(92, 67, 207, 0.28) transparent;
}

body.theme-midautumn .conversation-list::-webkit-scrollbar,
body.theme-midautumn .messages::-webkit-scrollbar,
body.theme-midautumn .trace-list::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body.theme-midautumn .conversation-list::-webkit-scrollbar-track,
body.theme-midautumn .messages::-webkit-scrollbar-track,
body.theme-midautumn .trace-list::-webkit-scrollbar-track {
  background: transparent;
}

body.theme-midautumn .conversation-list::-webkit-scrollbar-thumb,
body.theme-midautumn .messages::-webkit-scrollbar-thumb,
body.theme-midautumn .trace-list::-webkit-scrollbar-thumb {
  background: rgba(92, 67, 207, 0.28);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

body.theme-midautumn .conversation-list::-webkit-scrollbar-thumb:hover,
body.theme-midautumn .messages::-webkit-scrollbar-thumb:hover,
body.theme-midautumn .trace-list::-webkit-scrollbar-thumb:hover {
  background: rgba(92, 67, 207, 0.45);
  background-clip: padding-box;
}

body.theme-midautumn .conversation-list::-webkit-scrollbar-corner,
body.theme-midautumn .messages::-webkit-scrollbar-corner,
body.theme-midautumn .trace-list::-webkit-scrollbar-corner {
  background: transparent;
}
