/* ============================================================
   AI 對話視窗 — 行動階段底列第三張卡 / 反思模式右欄
   原始尺寸,小字最低 13px
   ============================================================ */

.hd-chat {
  display: flex;
  flex-direction: column;
  background: var(--hd-card);
  border: 1px solid var(--hd-line-soft);
  border-radius: var(--hd-radius-lg);
  box-shadow: var(--hd-shadow-sm);
  overflow: hidden;
  min-height: 0;
}

.hd-chat__head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--hd-card-soft);
  border-bottom: 1px solid var(--hd-line-soft);
}
.hd-chat__head-icon {
  width: 24px; height: 24px;
  border-radius: 7px;
  background: var(--hd-mist);
  color: #E8E0CC;
  display: grid; place-items: center;
}
.hd-chat__head-title {
  font-family: var(--hd-font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--hd-ink);
}
.hd-chat__head-sub {
  font-size: 13px;
  color: var(--hd-ink-muted);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-left: auto;
}

.hd-chat__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--hd-paper);
}

.hd-chat__msg {
  display: flex;
  max-width: 85%;
}
.hd-chat__msg--ai   { align-self: flex-start; }
.hd-chat__msg--user { align-self: flex-end; }

.hd-chat__bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.hd-chat__msg--ai .hd-chat__bubble {
  background: var(--hd-card);
  color: var(--hd-ink);
  border: 1px solid var(--hd-line-soft);
  border-top-left-radius: 4px;
}
.hd-chat__msg--user .hd-chat__bubble {
  background: var(--hd-ink);
  color: var(--hd-paper);
  border-top-right-radius: 4px;
}

.hd-chat__form {
  display: flex; gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--hd-line-soft);
  background: var(--hd-card);
}
.hd-chat__input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--hd-line);
  border-radius: 10px;
  background: var(--hd-card-soft);
  color: var(--hd-ink);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  resize: none;
}
.hd-chat__input:focus {
  border-color: var(--hd-ink-soft);
  background: var(--hd-card);
}
.hd-chat__send {
  background: var(--hd-ink);
  color: var(--hd-paper);
  border: 0;
  border-radius: 10px;
  padding: 0 16px;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--hd-font-display);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.hd-chat__send:hover { background: #16120c; transform: translateY(-1px); }
.hd-chat__send:disabled { opacity: .35; cursor: not-allowed; transform: none; }

/* ── typing 指示器(AI 思考中) ── */
.hd-chat__typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 14px !important;
}
.hd-chat__typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--hd-ink-soft);
  display: inline-block;
  animation: hd-typing-bounce 1.2s ease-in-out infinite;
}
.hd-chat__typing-dot:nth-child(2) { animation-delay: .15s; }
.hd-chat__typing-dot:nth-child(3) { animation-delay: .30s; }
@keyframes hd-typing-bounce {
  0%, 80%, 100% { transform: scale(.7); opacity: .45; }
  40%           { transform: scale(1.1); opacity: 1; }
}

.hd-chat__input:disabled {
  opacity: .55;
  cursor: not-allowed;
}
