/* ============ AI · DeepSeek 风格界面 ============ */
.ds-app {
  display: flex;
  height: calc(100vh - 220px);
  min-height: 560px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* 侧栏 */
.ds-sidebar {
  width: 244px;
  flex: 0 0 244px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}
.ds-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 16px 16px 12px;
}
.ds-brand-logo {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: linear-gradient(135deg, #4D6BFE, #7C5CFF);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.ds-brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.ds-new {
  margin: 0 12px 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: all 0.18s;
}
.ds-new:hover {
  background: rgba(77, 107, 254, 0.12);
  border-color: #4D6BFE;
  color: #8FA6FF;
}

.ds-sessions {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 8px;
}
.ds-session {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.ds-session:hover {
  background: rgba(255, 255, 255, 0.05);
}
.ds-session.active {
  background: rgba(77, 107, 254, 0.16);
}
.ds-session-main {
  flex: 1;
  min-width: 0;
}
.ds-session-title {
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ds-session-time {
  font-size: 10.5px;
  color: var(--text-mute);
  margin-top: 2px;
}
.ds-session-del {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-mute);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s;
}
.ds-session:hover .ds-session-del {
  opacity: 1;
}
.ds-session-del:hover {
  background: rgba(246, 70, 93, 0.2);
  color: #F6465D;
}
.ds-session-empty {
  padding: 20px 12px;
  font-size: 12px;
  color: var(--text-mute);
  text-align: center;
}

.ds-side-foot {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
}
.ds-model-label {
  display: block;
  font-size: 10.5px;
  color: var(--text-mute);
  margin-bottom: 5px;
}
.ds-model {
  width: 100%;
  padding: 7px 9px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.ds-status {
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--text-mute);
  line-height: 1.5;
  word-break: break-all;
}
.ds-status-error {
  color: #F6465D;
}

/* 主区 */
.ds-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ds-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.ds-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.ds-clear {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
}
.ds-clear:hover {
  color: var(--text);
  border-color: var(--blue);
}

.ds-messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px 8px;
}

/* 欢迎页 */
.ds-welcome {
  max-width: 720px;
  margin: 5vh auto 0;
  text-align: center;
}
.ds-welcome-logo {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
  background: linear-gradient(135deg, #4D6BFE, #7C5CFF);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}
.ds-welcome-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.ds-welcome-sub {
  font-size: 12.5px;
  color: var(--text-mute);
  margin-bottom: 26px;
}
.ds-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  text-align: left;
}
.ds-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg-panel);
  cursor: pointer;
  transition: all 0.18s;
}
.ds-card:hover {
  border-color: #4D6BFE;
  background: rgba(77, 107, 254, 0.08);
  transform: translateY(-2px);
}
.ds-card-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(77, 107, 254, 0.16);
  color: #8FA6FF;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
}
.ds-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.ds-card-desc {
  font-size: 11px;
  color: var(--text-mute);
}

/* 消息 */
.ds-row {
  width: 100%;
  max-width: 820px;
  margin: 0 auto 20px;
  display: flex;
  gap: 11px;
}
.ds-row-user {
  justify-content: flex-end;
}
.ds-bubble {
  max-width: 78%;
  padding: 10px 15px;
  border-radius: 14px 14px 4px 14px;
  background: rgba(77, 107, 254, 0.18);
  border: 1px solid rgba(77, 107, 254, 0.28);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text);
  word-break: break-word;
}
.ds-row-ai {
  align-items: flex-start;
}
.ds-avatar {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #4D6BFE, #7C5CFF);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}
.ds-content {
  flex: 1;
  min-width: 0;
}
.ds-md {
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--text);
  word-break: break-word;
}
.ds-md .ds-p {
  margin: 0 0 2px;
}
.ds-md .ds-gap {
  height: 8px;
}
.ds-md .ds-h1 {
  font-size: 17px;
  font-weight: 700;
  margin: 12px 0 6px;
}
.ds-md .ds-h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 12px 0 6px;
  color: var(--text);
}
.ds-md .ds-h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 10px 0 5px;
  color: #8FA6FF;
}
.ds-md .ds-h4 {
  font-size: 13px;
  font-weight: 700;
  margin: 8px 0 4px;
}
.ds-md .ds-ul,
.ds-md .ds-ol {
  margin: 4px 0 6px;
  padding-left: 20px;
}
.ds-md .ds-ul li,
.ds-md .ds-ol li {
  margin: 3px 0;
}
.ds-md .ds-quote {
  border-left: 3px solid #4D6BFE;
  padding: 6px 12px;
  margin: 8px 0;
  background: rgba(77, 107, 254, 0.07);
  color: var(--text-dim);
  border-radius: 0 6px 6px 0;
}
.ds-md .ds-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}
.ds-md .ds-inline {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  color: #FFB86C;
}
.ds-md .ds-table-wrap {
  overflow-x: auto;
  margin: 10px 0;
}
.ds-md .ds-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
}
.ds-md .ds-table th,
.ds-md .ds-table td {
  border: 1px solid var(--border);
  padding: 7px 10px;
  text-align: left;
}
.ds-md .ds-table th {
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
}
.ds-md .ds-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.ds-code {
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  background: #0d1117;
}
.ds-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 11px;
  color: var(--text-mute);
}
.ds-code-copy {
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
}
.ds-code-copy:hover {
  color: var(--blue);
}
.ds-code pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
}
.ds-code code {
  font-family: Consolas, Monaco, monospace;
  font-size: 12px;
  line-height: 1.65;
  color: #C9D1D9;
}

.ds-reasoning {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
}
.ds-reasoning summary {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.ds-reasoning-body {
  padding: 0 12px 10px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-mute);
}

.ds-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity 0.15s;
}
.ds-row-ai:hover .ds-actions {
  opacity: 1;
}
.ds-act {
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-mute);
  font-size: 11px;
  cursor: pointer;
}
.ds-act:hover {
  color: var(--text);
  border-color: var(--blue);
}

.ds-typing {
  display: flex;
  gap: 4px;
  padding: 6px 0;
}
.ds-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4D6BFE;
  animation: dsBlink 1.2s infinite ease-in-out;
}
.ds-typing span:nth-child(2) {
  animation-delay: 0.18s;
}
.ds-typing span:nth-child(3) {
  animation-delay: 0.36s;
}
@keyframes dsBlink {
  0%, 80%, 100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* 输入区 */
.ds-composer-wrap {
  padding: 10px 20px 14px;
  border-top: 1px solid var(--border);
}
.ds-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 820px;
  margin: 0 auto;
  padding: 8px 8px 8px 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: border-color 0.18s;
}
.ds-composer:focus-within {
  border-color: #4D6BFE;
}
.ds-input {
  flex: 1;
  min-height: 24px;
  max-height: 180px;
  padding: 5px 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.65;
  resize: none;
  font-family: inherit;
}
.ds-send {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #4D6BFE;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all 0.18s;
}
.ds-send:hover {
  background: #5F7BFF;
}
.ds-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ds-send.ds-stop {
  background: #F6465D;
  font-size: 11px;
}
.ds-foot-tip {
  max-width: 820px;
  margin: 8px auto 0;
  text-align: center;
  font-size: 10.5px;
  color: var(--text-mute);
}

@media (max-width: 860px) {
  .ds-app {
    height: calc(100vh - 190px);
    min-height: 480px;
  }
  .ds-sidebar {
    display: none;
  }
  .ds-messages {
    padding: 16px 14px 4px;
  }
  .ds-cards {
    grid-template-columns: 1fr;
  }
  .ds-bubble {
    max-width: 88%;
  }
}
