/* ── AI聊天 ── */
.ai-chat-wrap {
  background: var(--card-bg,#fff); border-radius: 20px; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.06); margin: 20px 0;
}
.ai-chat-header {
  background: linear-gradient(135deg, #6C5CE7, #a29bfe);
  color: #fff; padding: 14px 20px; font-weight: 700; font-size: 17px;
}
.ai-chat-msgs {
  height: 280px; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.ai-msg {
  max-width: 85%; padding: 10px 16px; border-radius: 16px;
  font-size: 15px; line-height: 1.6; word-break: break-word;
}
.ai-msg-user {
  align-self: flex-end; background: linear-gradient(135deg, #6C5CE7, #a29bfe);
  color: #fff; border-bottom-right-radius: 4px;
}
.ai-msg-bot {
  align-self: flex-start; background: #F0F4FF; color: #334155;
  border-bottom-left-radius: 4px;
}
.ai-chat-input-row {
  display: flex; padding: 12px 16px; border-top: 1px solid #eee; gap: 8px;
}
.ai-chat-input {
  flex: 1; padding: 10px 16px; border: 2px solid #DFE6E9;
  border-radius: 24px; font-size: 15px; outline: none;
  font-family: inherit;
}
.ai-chat-input:focus { border-color: #6C5CE7; }
.ai-chat-send {
  padding: 10px 24px; border: none; border-radius: 24px;
  background: linear-gradient(135deg, #6C5CE7, #a29bfe);
  color: #fff; font-weight: 700; font-size: 15px; cursor: pointer;
  white-space: nowrap; transition: transform .15s;
}
.ai-chat-send:hover { transform: scale(1.05); }
.ai-loading { color: #B2BEC3; }
.ai-dots span { animation: aiDot 1.4s infinite; opacity: 0; }
.ai-dots span:nth-child(1) { animation-delay: 0s; }
.ai-dots span:nth-child(2) { animation-delay: .2s; }
.ai-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes aiDot { 0%,60%,100% { opacity: 0; } 30% { opacity: 1; } }

/* ── 画布 ── */
.ai-canvas-wrap {
  background: var(--card-bg,#fff); border-radius: 20px; overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.06); margin: 20px 0; text-align: center;
}
.ai-canvas-tools {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  flex-wrap: wrap; justify-content: center; border-bottom: 1px solid #eee;
}
.ai-tool-btn {
  padding: 6px 14px; border: 2px solid #DFE6E9; border-radius: 999px;
  background: #fff; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s; white-space: nowrap;
}
.ai-tool-btn:hover, .ai-tool-btn.active { border-color: #6C5CE7; background: #F0F4FF; }
.ai-color-picker { width: 32px; height: 32px; border: none; border-radius: 50%; cursor: pointer; }
.ai-size-slider { width: 80px; accent-color: #6C5CE7; }
.ai-size-label { font-size: 12px; color: #B2BEC3; }
.ai-clear-btn { border-color: #FF6B6B; color: #FF6B6B; }
.ai-clear-btn:hover { background: #FFF0F0; }
.ai-save-btn { border-color: #00B894; color: #00B894; }
.ai-save-btn:hover { background: #F0FFF8; }
.ai-canvas {
  max-width: 100%; height: auto; margin: 16px; border: 2px solid #eee;
  border-radius: 12px; cursor: crosshair;
}

/* ── AI 生图 ── */
.ai-img-result { text-align: center; padding: 16px; }
.ai-img-prompt { font-size: 15px; color: #6C5CE7; margin-bottom: 12px; font-weight: 600; }
.ai-img-gen { max-width: 100%; border-radius: 16px; box-shadow: 0 8px 30px rgba(0,0,0,.1); }
.ai-img-loading { color: #B2BEC3; font-size: 14px; }

/* ── AI 代码生成 ── */
.ai-code-loading { text-align: center; padding: 40px; font-size: 18px; color: #B2BEC3; }
.ai-code-result { margin: 20px 0; }
.ai-code-explain { background: #F0F4FF; padding: 16px 20px; border-radius: 16px;
  font-size: 14px; color: #334155; margin-bottom: 12px; line-height: 1.7; }
.ai-code-block { background: #1E1E2E; border-radius: 16px; overflow: hidden; }
.ai-code-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: #2D2D3F; color: #ccc; font-size: 13px;
}
.ai-code-copy {
  background: none; border: 1px solid #555; color: #aaa; padding: 4px 12px;
  border-radius: 8px; font-size: 12px; cursor: pointer; transition: all .15s;
}
.ai-code-copy:hover { border-color: #6C5CE7; color: #6C5CE7; }
.ai-code-block pre {
  margin: 0; padding: 16px 20px; overflow-x: auto;
  font-family: 'SF Mono','Fira Code',monospace; font-size: 13px;
  line-height: 1.6; color: #E0E0E0;
}
.ai-code-run-hint {
  display: block; width: 100%; margin-top: 12px; padding: 10px;
  background: #F0FFF8; border: 2px dashed #00B894; border-radius: 12px;
  color: #00B894; font-size: 14px; font-weight: 600; cursor: default;
  text-align: center;
}

/* ── 作品展示区 ── */
.artwork-section {
  background: #fff; border-radius: 20px; padding: 24px;
  box-shadow: 0 4px 20px rgba(0,0,0,.06); margin: 20px 0;
}
.artwork-section h3 {
  font-size: 20px; color: #6C5CE7; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.artwork-gallery {
  display: grid; grid-template-columns: repeat(auto-fill,minmax(150px,1fr));
  gap: 12px; margin-top: 12px;
}
.artwork-card {
  background: #F8F9FA; border-radius: 12px; padding: 10px;
  text-align: center; border: 2px solid #eee; transition: all .2s;
}
.artwork-card:hover { border-color: #6C5CE7; transform: translateY(-2px); }
.artwork-card img { max-width: 100%; border-radius: 8px; }
.artwork-card .label { font-size: 12px; color: #636E72; margin-top: 6px; }
