/* 深度对话 — 白紫 onboarding UI（参考 深度对话/css/styles.css） */

:root {
  --dd-bg: #ffffff;
  --dd-fg: #2d1b4e;
  --dd-purple: #7c3aed;
  --dd-purple-deep: #6d28d9;
  --dd-text-accent: #5b21b6;
  --dd-purple-light: #faf8ff;
  --dd-purple-muted: #f5f3ff;
  --dd-border: #e9e3ff;
  --dd-muted: #475569;
  --dd-radius: 12px;
  --dd-sidebar-w: 18rem;
  --dd-topbar-h: 70px;
}

/* ========== 页面基础 ========== */
body[data-page-subtitle="深度对话"] {
  --text: var(--dd-fg);
  --muted: #475569;
  background: var(--dd-bg) !important;
  color: var(--dd-fg);
  font-family: "Noto Sans SC", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body[data-page-subtitle="深度对话"] .dd-page {
  width: 100%;
  max-width: none !important;
  margin: 0;
  padding: 0 !important;
  min-height: calc(100vh - var(--dd-topbar-h));
}

body[data-page-subtitle="深度对话"] .dd-layout {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: calc(100vh - var(--dd-topbar-h));
  height: calc(100vh - var(--dd-topbar-h));
}

/* ========== 侧栏 ========== */
body[data-page-subtitle="深度对话"] .dd-phases {
  width: var(--dd-sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  border-right: 1px solid var(--dd-border);
  border-radius: 0;
  padding: 0;
  background: var(--dd-purple-light);
  box-shadow: none;
  backdrop-filter: none;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 100%;
}

.dd-progress-header {
  padding: 1rem;
  border-bottom: 1px solid rgba(233, 227, 255, 0.8);
  flex-shrink: 0;
}

.dd-progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.dd-progress-row span:last-child {
  font-weight: 700;
  color: var(--dd-purple);
}

.dd-progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--dd-purple-muted);
  overflow: hidden;
}

.dd-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--dd-purple-deep), var(--dd-purple));
  transition: width 0.5s ease;
}

.dd-progress-hint {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--dd-muted);
}

.dd-phase-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.dd-phase {
  width: 100%;
  text-align: left;
  padding: 0.75rem;
  margin-bottom: 0.25rem;
  border: 1px solid transparent;
  border-radius: var(--dd-radius);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
  position: relative;
}

.dd-phase:hover:not(.active) {
  background: rgba(245, 243, 255, 0.8);
}

.dd-phase.active {
  background: var(--dd-purple-light);
  border-color: rgba(124, 58, 237, 0.4);
  box-shadow: 0 0 16px rgba(124, 58, 237, 0.12);
}

.dd-phase-ico {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(245, 243, 255, 0.9);
  color: var(--dd-muted);
  font-size: 0;
  line-height: 1;
  opacity: 1;
}

.dd-phase-ico svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

.dd-phase.active .dd-phase-ico {
  background: rgba(124, 58, 237, 0.12);
  color: var(--dd-purple);
}

.dd-phase-text {
  flex: 1;
  min-width: 0;
}

.dd-phase-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--dd-fg);
  margin-bottom: 0.125rem;
}

.dd-phase.active .dd-phase-title {
  color: var(--dd-purple);
}

.dd-phase-sub {
  display: block;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--dd-muted);
}

.dd-phase-foot {
  flex-shrink: 0;
  padding: 0.75rem;
  border-top: 1px solid rgba(233, 227, 255, 0.8);
  margin-top: auto;
}

.dd-next-phase {
  width: 100%;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  border: 1px solid rgba(124, 58, 237, 0.4);
  border-radius: 8px;
  background: transparent;
  color: var(--dd-purple);
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.2s;
}

.dd-next-phase:hover {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.4);
}

/* ========== 主聊天区 ========== */
body[data-page-subtitle="深度对话"] .dd-chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  background: var(--dd-bg);
  box-shadow: none;
  backdrop-filter: none;
  height: 100%;
  overflow: hidden;
}

.dd-mobile-select {
  display: none;
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid rgba(233, 227, 255, 0.8);
  background: rgba(255, 255, 255, 0.9);
}

.dd-mobile-select select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--dd-border);
  border-radius: 8px;
  background: var(--dd-purple-light);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--dd-fg);
  outline: none;
}

body[data-page-subtitle="深度对话"] .dd-chat-head {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(233, 227, 255, 0.8);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.dd-head-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(124, 58, 237, 0.1);
  color: var(--dd-purple);
  font-size: 0;
  line-height: 1;
  box-shadow: none;
}

.dd-head-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

.dd-head-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.dd-chat-head h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--dd-fg);
  line-height: 1.2;
}

.dd-chat-subtitle {
  margin: 0.125rem 0 0;
  font-size: 0.875rem;
  color: var(--dd-muted);
}

.dd-chat-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dd-chat-action {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--dd-border);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--dd-muted);
  background: transparent;
  box-shadow: none;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.dd-chat-action:hover {
  color: var(--dd-purple);
  border-color: rgba(124, 58, 237, 0.4);
  background: rgba(124, 58, 237, 0.06);
}

.dd-chat-action-icon-only {
  width: 32px;
  padding: 0;
}

.dd-chat-action svg,
.dd-chat-action-ico svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  display: block;
}

.dd-chat-action-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dd-chat-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ========== 消息区 ========== */
body[data-page-subtitle="深度对话"] .dd-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: transparent;
  transition: opacity 0.15s ease;
}

body[data-page-subtitle="深度对话"] .dd-messages.dd-messages--switching {
  opacity: 0.55;
}

body[data-page-subtitle="深度对话"] .dd-messages:has(.dd-welcome) {
  justify-content: center;
}

.dd-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 36rem;
  margin: 0 auto;
  width: 100%;
  gap: 0;
}

.dd-welcome[hidden] {
  display: none !important;
}

.dd-welcome::before {
  content: "";
  display: block;
  order: 1;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 1.25rem;
  border-radius: 1rem;
  background: rgba(124, 58, 237, 0.22) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234c1d95' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719'/%3E%3C/svg%3E") center / 1.75rem no-repeat;
  border: 1px solid rgba(91, 33, 182, 0.45);
}

.dd-welcome::after {
  content: "开始对话";
  display: block;
  order: 2;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dd-purple-deep);
}

.dd-welcome .dd-msg-row {
  display: contents;
}

.dd-welcome .dd-msg-avatar,
.dd-welcome .dd-msg-time {
  display: none;
}

.dd-welcome .dd-msg.assistant {
  max-width: none;
  padding: 0;
  margin: 0 0 2rem;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  order: 3;
}

.dd-welcome .dd-chips {
  order: 4;
}

.dd-chat-lead {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #334155;
}

.dd-welcome .dd-chat-lead strong {
  color: var(--dd-purple-deep);
  font-weight: 700;
}

body[data-page-subtitle="深度对话"] .dd-welcome {
  color: var(--dd-fg);
}

body[data-page-subtitle="深度对话"] .dd-welcome .dd-chat-lead {
  color: #1e293b;
  font-weight: 500;
}

body[data-page-subtitle="深度对话"] .dd-welcome .dd-chat-lead strong {
  color: var(--dd-text-accent);
  font-weight: 700;
}

body[data-page-subtitle="深度对话"] .dd-welcome .dd-chip {
  color: #5b21b6;
  background: #f3e8ff;
  border-color: rgba(91, 33, 182, 0.4);
}

.dd-welcome .dd-date-divider {
  display: none;
}

body[data-page-subtitle="深度对话"] .dd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  width: 100%;
  padding-left: 0;
}

.dd-chip {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.875rem;
  border: 1px solid rgba(124, 58, 237, 0.35);
  background: rgba(245, 243, 255, 0.8);
  color: var(--dd-purple-deep);
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  box-shadow: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

body[data-page-subtitle="深度对话"] .dd-chip {
  color: var(--dd-purple-deep);
}

.dd-chip:hover {
  border-color: rgba(124, 58, 237, 0.5);
  color: var(--dd-text-accent);
  background: rgba(237, 233, 254, 0.95);
  transform: none;
}

/* 对话气泡 */
.dd-msg-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: 100%;
}

.dd-msg-row.user {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.dd-msg-row.assistant {
  align-self: flex-start;
}

.dd-msg-avatar {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  line-height: 1;
  background: rgba(245, 243, 255, 0.9);
  border: 1px solid var(--dd-border);
  box-shadow: none;
}

.dd-msg-avatar svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

.dd-msg-row.user .dd-msg-avatar {
  background: rgba(124, 58, 237, 0.12);
  border-color: transparent;
  color: var(--dd-purple);
}

.dd-msg {
  max-width: min(68%, 520px);
  padding: 0.75rem 1rem;
  border-radius: var(--dd-radius);
  font-size: 0.875rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.dd-msg.user {
  background: rgba(124, 58, 237, 0.1);
  color: var(--dd-fg);
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-bottom-right-radius: 4px;
}

.dd-msg.assistant {
  background: var(--dd-bg);
  border: 1px solid var(--dd-border);
  color: var(--dd-fg);
  border-bottom-left-radius: 4px;
  box-shadow: none;
}

.dd-msg.assistant.loading {
  color: var(--dd-muted);
}

.dd-msg-time {
  display: block;
  margin-top: 0.5rem;
  color: var(--dd-muted);
  font-size: 0.75rem;
  line-height: 1;
}

.dd-date-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: min(520px, 70%);
  margin: 0.5rem auto;
  color: var(--dd-muted);
  font-size: 0.8125rem;
}

.dd-date-divider::before,
.dd-date-divider::after {
  content: "";
  height: 1px;
  flex: 1 1 auto;
  background: var(--dd-border);
}

/* ========== 输入区 ========== */
.dd-compose-wrap {
  flex-shrink: 0;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(233, 227, 255, 0.8);
  background: var(--dd-bg);
}

.dd-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dd-image-preview {
  max-width: 56rem;
  margin: 0 auto 0.5rem;
}

.dd-image-preview[hidden] {
  display: none !important;
}

.dd-image-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 10px 6px 6px;
  border: 1px solid rgba(142, 120, 255, 0.35);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(103, 74, 255, 0.08);
}

.dd-image-chip--loading {
  color: var(--dd-muted);
  font-size: 0.8125rem;
  padding: 8px 12px;
}

.dd-image-chip img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 10px;
  flex: 0 0 auto;
}

.dd-image-name {
  font-size: 0.8125rem;
  color: var(--dd-fg);
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dd-image-remove {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: rgba(124, 58, 237, 0.1);
  color: var(--dd-purple);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.dd-image-remove:hover {
  background: rgba(124, 58, 237, 0.18);
}

.dd-msg-image {
  display: block;
  max-width: min(100%, 240px);
  max-height: 180px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 0.5rem;
  border: 1px solid rgba(142, 120, 255, 0.25);
}

.dd-msg-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.dd-model-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  color: var(--dd-muted);
  max-width: 56rem;
  margin-left: auto;
  margin-right: auto;
}

.dd-compose {
  position: relative;
  max-width: 56rem;
  margin: 0 auto;
  width: 100%;
  min-height: var(--dd-compose-control-h, 44px);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid rgba(142, 120, 255, 0.35);
  border-radius: 28px;
  padding: 8px 52px 8px 12px;
  box-shadow: 0 12px 32px rgba(103, 74, 255, 0.1);
  backdrop-filter: blur(12px);
  --dd-compose-control-h: 40px;
}

.dd-compose:focus-within {
  border-color: rgba(124, 58, 237, 0.55);
  box-shadow: 0 14px 36px rgba(103, 74, 255, 0.14), 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.dd-next-phase svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

.dd-compose-icon {
  flex: 0 0 var(--dd-compose-control-h, 44px);
  width: var(--dd-compose-control-h, 44px);
  height: var(--dd-compose-control-h, 44px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111827;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 6px 16px rgba(17, 24, 39, 0.06);
}

.dd-compose-icon:hover {
  color: var(--dd-purple);
}

.dd-compose-icon svg {
  width: 1.125rem;
  height: 1.125rem;
  display: block;
}

.dd-input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  height: var(--dd-compose-control-h, 44px);
  min-height: var(--dd-compose-control-h, 44px);
  max-height: 74px;
  margin: 0;
  resize: none;
  border: 0 !important;
  border-radius: 0 !important;
  padding: 0 6px !important;
  overflow: hidden;
  font-size: 1rem;
  line-height: var(--dd-compose-control-h, 44px);
  font-family: inherit;
  background: transparent !important;
  color: var(--dd-fg);
  outline: none !important;
  box-shadow: none !important;
}

.dd-input:focus {
  border: 0 !important;
  box-shadow: none !important;
  outline: none !important;
}

.dd-input::placeholder {
  color: var(--dd-muted);
  line-height: var(--dd-compose-control-h, 44px);
}

.dd-compose-tools {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 2;
}

.dd-model-select {
  border: 1px solid var(--dd-border);
  border-radius: 999px;
  padding: 4px 24px 4px 10px;
  font-size: 0.75rem;
  background: var(--dd-purple-light);
  color: var(--dd-fg);
  max-width: 120px;
  outline: none;
  font-family: inherit;
  cursor: pointer;
}

.dd-model-select:hover {
  border-color: rgba(124, 58, 237, 0.4);
  color: var(--dd-purple);
}

.dd-mic {
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--dd-muted);
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
}

.dd-mic:hover {
  color: var(--dd-purple);
  background: var(--dd-purple-muted);
}

.dd-send {
  width: 36px;
  height: 36px;
  min-height: 36px;
  flex: 0 0 36px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--dd-purple);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.18);
  flex-shrink: 0;
  padding: 0;
  transition: color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.dd-send:hover {
  color: #fff;
  background: linear-gradient(145deg, #a78bfa 0%, #7c3aed 100%);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.28);
  transform: translateY(-1px);
}

.dd-send:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.2);
}

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

.dd-send-ico {
  display: block;
  width: 17px;
  height: 17px;
  margin-left: 1px;
}

.dd-quota {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--dd-muted);
  text-align: center;
}

/* ========== 滚动条 ========== */
body[data-page-subtitle="深度对话"] ::-webkit-scrollbar {
  width: 6px;
}

body[data-page-subtitle="深度对话"] ::-webkit-scrollbar-track {
  background: var(--dd-purple-muted);
}

body[data-page-subtitle="深度对话"] ::-webkit-scrollbar-thumb {
  background: #c4b5fd;
  border-radius: 3px;
}

body[data-page-subtitle="深度对话"] ::-webkit-scrollbar-thumb:hover {
  background: var(--dd-purple);
}

/* ========== 响应式 ========== */
@media (max-width: 767px) {
  body[data-page-subtitle="深度对话"] {
    overflow: auto;
  }

  body[data-page-subtitle="深度对话"] .dd-layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - var(--dd-topbar-h));
  }

  body[data-page-subtitle="深度对话"] .dd-phases {
    display: none;
  }

  .dd-mobile-select {
    display: block;
  }

  body[data-page-subtitle="深度对话"] .dd-chat {
    height: auto;
    min-height: calc(100vh - var(--dd-topbar-h) - 52px);
  }

  .dd-chat-actions {
    display: none;
  }

  body[data-page-subtitle="深度对话"] .dd-messages {
    padding: 1.5rem 1rem;
  }

  .dd-compose-wrap {
    padding: 1rem;
  }

  .dd-compose {
    gap: 8px;
    padding: 8px 48px 8px 10px;
    --dd-compose-control-h: 38px;
    border-radius: 24px;
  }

  .dd-compose-tools {
    right: 6px;
  }

  .dd-compose-icon {
    flex: 0 0 var(--dd-compose-control-h, 40px);
    width: var(--dd-compose-control-h, 40px);
    height: var(--dd-compose-control-h, 40px);
  }

  .dd-input {
    font-size: 0.9375rem;
    height: var(--dd-compose-control-h, 40px);
    min-height: var(--dd-compose-control-h, 40px);
    line-height: var(--dd-compose-control-h, 40px);
    padding: 0 4px !important;
  }

  .dd-compose-tools {
    gap: 4px;
  }

  .dd-mic {
    width: 2rem;
    height: 2rem;
  }

  .dd-send {
    width: 34px;
    height: 34px;
    min-height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
  }

  .dd-model-select {
    display: none;
  }

  .dd-msg {
    max-width: 85%;
  }
}

@media (max-width: 980px) and (min-width: 768px) {
  .dd-chat-action:not(#ddClearChat):not(#ddViewArchive) {
    display: none;
  }
}

/* ========== 对话档案弹层 ========== */
body.dd-archive-open {
  overflow: hidden;
}

.dd-archive-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(59, 38, 103, 0.35);
  backdrop-filter: blur(4px);
}

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

.dd-archive-panel {
  width: min(720px, 100%);
  max-height: min(85vh, 800px);
  display: flex;
  flex-direction: column;
  background: var(--dd-bg);
  border: 1px solid var(--dd-border);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(91, 33, 182, 0.18);
  overflow: hidden;
}

.dd-archive-head {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--dd-border);
  background: var(--dd-purple-light);
}

.dd-archive-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--dd-fg);
}

.dd-archive-close {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--dd-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}

.dd-archive-close:hover {
  background: rgba(124, 58, 237, 0.1);
  color: var(--dd-purple);
}

.dd-archive-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 1.5rem;
}

.dd-archive-empty {
  margin: 0;
  color: var(--dd-muted);
  font-size: 0.875rem;
  text-align: center;
  padding: 2rem 0;
}

.dd-archive-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--dd-border);
}

.dd-archive-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.dd-archive-section-title {
  margin: 0 0 0.375rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--dd-fg);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dd-archive-status {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--dd-purple-muted);
  color: var(--dd-muted);
}

.dd-archive-status--in_progress {
  background: rgba(124, 58, 237, 0.12);
  color: var(--dd-purple);
}

.dd-archive-status--completed {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.dd-archive-status--skipped {
  background: rgba(148, 163, 184, 0.2);
  color: #64748b;
}

.dd-archive-section-sub {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  color: var(--dd-muted);
}

.dd-archive-content {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--dd-fg);
  white-space: pre-wrap;
  word-break: break-word;
}

.dd-chips--inline {
  padding: 1rem 0 0;
  justify-content: flex-start;
}

/* ========== 超级IP孵化嵌入（宿主 body 非「深度对话」） ========== */
.flow-main .dd-page {
  width: 100%;
  max-width: none !important;
  margin: 0;
  padding: 0 !important;
  min-height: 640px;
}

.flow-main .dd-layout {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 640px;
  height: auto;
}

.flow-main .dd-phases {
  width: var(--dd-sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  border-right: 1px solid var(--dd-border);
  border-radius: 0;
  padding: 0;
  background: var(--dd-purple-light);
  box-shadow: none;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 100%;
}

.flow-main .dd-chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  background: var(--dd-bg);
  box-shadow: none;
  backdrop-filter: none;
  min-height: 640px;
  height: auto;
  overflow: hidden;
}

.flow-main .dd-chat-head {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(233, 227, 255, 0.8);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.flow-main .dd-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: transparent;
}

.flow-main .dd-messages:has(.dd-welcome) {
  justify-content: center;
}

.flow-main .dd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  width: 100%;
  padding-left: 0;
}

.flow-main .dd-compose-wrap {
  flex-shrink: 0;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(233, 227, 255, 0.8);
  background: var(--dd-bg);
}

@media (max-width: 980px) {
  .flow-main .dd-layout {
    flex-direction: column;
    min-height: 0;
  }

  .flow-main .dd-phases {
    display: none;
  }

  .flow-main .dd-mobile-select {
    display: block;
  }

  .flow-main .dd-chat {
    min-height: 560px;
  }
}

@media (max-width: 767px) {
  .dd-archive-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .dd-archive-panel {
    width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }
}
