* { box-sizing: border-box; }

:root { --page-max: 1320px; }

body {
  margin: 0 auto;
  max-width: 1380px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f7f3cf;
  color: #3f3f56;
  padding: 18px;
  font-size: 14px;
  line-height: 1.45;
}

.dot { position: fixed; border-radius: 50%; opacity: .25; z-index: 0; pointer-events: none; }
.dot1 { width: 90px; height: 90px; background: #ffb8c6; left: 22px; top: 52px; }
.dot2 { width: 100px; height: 100px; background: #cdb4ff; left: 220px; bottom: 80px; }
.dot3 { width: 90px; height: 90px; background: #a0d8ff; right: 160px; top: 280px; }

.topbar, .grid-main, .card { position: relative; z-index: 1; }

/* 头部与内容同宽 */
body > .topbar {
  width: 100%;
  max-width: var(--page-max);
  margin-left: auto;
  margin-right: auto;
}
.grid-main {
  width: 100%;
  max-width: var(--page-max);
  margin-left: auto;
  margin-right: auto;
}

.topbar {
  background: rgba(244, 235, 249, .92);
  border: 1px solid #eddca2;
  border-radius: 16px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 {
  margin: 0;
  color: #b450dd;
  font-size: 38px;
  line-height: 1;
}
.brand p {
  margin: 2px 0 0;
  color: #595173;
  font-size: 14px;
}
.top-actions { display: flex; align-items: center; gap: 8px; }

.btn { border: none; border-radius: 12px; padding: 10px 14px; cursor: pointer; font-size: 14px; }
.btn.icon {
  background: #e8ddff; color: #7959df;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
}
.btn.icon svg { width: 18px; height: 18px; fill: currentColor; }
.btn.gray { background: #ececf0; color: #666; }
.btn.orange { background: linear-gradient(90deg, #ff8b2c, #ff5db1); color: #fff; }
.btn.purple { background: linear-gradient(90deg, #d044c0, #7a53f2); color: #fff; }
.btn.cyan { background: #14b8b0; color: #fff; }
.btn.danger { background: linear-gradient(90deg, #ff6a70, #e04357); color: #fff; }

.grid-main {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
}

.card {
  background: linear-gradient(135deg, #f7e9f2, #edf6ef);
  border: 1px solid #efdce9;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .05);
}

.title-row h2 {
  margin: 0;
  color: #6a55ff;
  font-size: 20px;
  line-height: 1.05;
}
.hint { margin-top: 8px; font-size: 14px; color: #6a6f86; }

.label {
  display: block;
  margin: 10px 0 6px;
  font-weight: 600;
  color: #666b82;
  font-size: 15px;
}

.input, select, textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: 12px;
  border: 1px solid #d8d8de;
  background: #fff;
  color: #3f3f56;
  font-size: 14px;
}
.input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #c767ef;
  box-shadow: 0 0 0 3px rgba(199, 103, 239, 0.14);
}
.textarea { min-height: 94px; resize: vertical; }

.toggle-line {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #555a72;
  font-size: 14px;
}
.toggle-line input { margin: 0; }

.row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.action-row .btn { height: 38px; padding: 0 12px; }

.status-wrap {
  margin-top: 12px;
  background: rgba(255, 255, 255, .42);
  border: 1px solid #ecddee;
  border-radius: 12px;
  padding: 10px 12px;
}
.status-wrap h3 { margin: 0 0 6px; font-size: 15px; color: #7a5bd8; }
.status {
  color: #666c87;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.45;
}

.right-panel { display: flex; flex-direction: column; min-height: 640px; }

.result { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.result-head { margin-bottom: 10px; }
.result h2 { margin: 0; color: #c950ea; font-size: 20px; }

.chat-list {
  flex: 1;
  min-height: 360px;
  max-height: calc(100vh - 360px);
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(255, 255, 255, .55);
  border: 1px solid #ecddee;
  border-radius: 14px;
  padding: 12px;
}
.empty { color: #7a7792; font-size: 13px; }

.msg { margin-bottom: 12px; display: flex; gap: 10px; }
.msg-role {
  width: 72px;
  flex-shrink: 0;
  color: #6e6a84;
  font-size: 12px;
  padding-top: 4px;
  font-weight: 600;
}
.msg-body { flex: 1; }
.model-tag {
  display: inline-block;
  font-size: 12px;
  color: #7d58d3;
  background: #f0e8ff;
  border: 1px solid #d9c9f5;
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 6px;
}
.msg-content {
  background: #ffffff;
  border: 1px solid #ddd1ee;
  border-radius: 12px;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  font-size: 14px;
}
.msg.user .msg-content { border-color: #c9d6ff; background: #f5f8ff; }
.msg.assistant .msg-content { border-color: #e6d2f3; background: #fff9ff; }

/* 推理页思考提示（reasoning.js 复用 search-meta 类） */
.search-meta {
  color: #7a7392;
  margin: 2px 0 8px;
  font-size: 12px;
  background: #f7f2ff;
  border: 1px dashed #d9c9f5;
  border-radius: 10px;
  padding: 6px 8px;
}

/* 兼容保留：若后续复用搜索卡片结构也可正常展示 */
.search-wrap {
  margin-bottom: 8px;
  border: 1px dashed #d8c4ea;
  border-radius: 10px;
  padding: 8px;
  background: #fcf9ff;
}
.search-title { color: #7b5cff; font-size: 13px; margin-bottom: 6px; }
.search-item {
  border: 1px solid #e4d8f1;
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 6px;
  background: #fff;
}
.search-item a { color: #4f63d8; text-decoration: none; font-size: 13px; }
.search-item a:hover { text-decoration: underline; }
.search-snippet { color: #4c4663; margin-top: 4px; font-size: 13px; line-height: 1.5; }

/* 动态思考提示 */
.search-meta {
  position: relative;
  padding-left: 28px;
}

.search-meta::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: #8b5cf6;
  box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.45);
  animation: thinking-pulse 1.4s ease-out infinite;
}

@keyframes thinking-pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.85;
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.45);
  }
  70% {
    transform: scale(1.15);
    opacity: 1;
    box-shadow: 0 0 0 8px rgba(139, 92, 246, 0);
  }
  100% {
    transform: scale(0.95);
    opacity: 0.85;
    box-shadow: 0 0 0 0 rgba(139, 92, 246, 0);
  }
}

.composer {
  margin-top: 12px;
  background: rgba(255, 255, 255, .45);
  border: 1px solid #ecddee;
  border-radius: 14px;
  padding: 12px;
}
.composer-input { min-height: 90px; resize: vertical; }

.composer-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.composer-actions .btn { height: 38px; padding: 0 14px; }
.composer-actions .btn:disabled { opacity: .55; cursor: not-allowed; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .4);
  display: grid;
  place-items: center;
  z-index: 310;
}
.hidden { display: none !important; }
.panel {
  width: min(520px, 92vw);
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  z-index: 370;
}
.panel h3 { margin: 0 0 10px; color: #5e45b2; font-size: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 10px; }
.test-msg { margin: 8px 0 0; font-size: 14px; color: #333; }

@media (max-width: 980px) {
  .grid-main { grid-template-columns: 1fr; }
  .right-panel { min-height: 560px; }
  .chat-list { max-height: none; min-height: 320px; }
  .brand h1 { font-size: 36px; }
  .title-row h2, .result h2 { font-size: 32px; }
}

@media (max-width: 768px) {
  body { padding: 12px; }
  .card { padding: 14px; }
  .row.two-col, .action-row { grid-template-columns: 1fr; }
}