/* 基本排版與色彩 */
:root {
  /* 🎨 背景色 */
  --bg: #81b9f4;              /* 頁面背景色 */

  /* 🎨 面板底色 */
  --panel: #9be880;           /* 頂部與輸入區背景 */

  /* 🎨 邊框色 */
  --border: #e5e7eb;

  /* 🎨 主要文字色 */
  --text: #111827;

  /* 🎨 次要/灰色文字 */
  --muted: #6b7280;

  /* 🎨 主色（按鈕、強調） */
  --primary: #2563eb;         /* 主色（正常狀態） */
  --primary-600: #1d4ed8;     /* 主色（hover 狀態） */

  /* 🎨 使用者訊息泡泡色 */
  --bubble-user: #d4d4d4;     /* 使用者泡泡背景 */
  --bubble-user-text: #ffffff;/* 使用者泡泡文字 */

  /* 🎨 機器人訊息泡泡色 */
  --bubble-bot: #ffffff;      /* 機器人泡泡背景 */
  --bubble-bot-text: #111827; /* 機器人泡泡文字 */
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "PingFang TC", "Noto Sans CJK TC", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  display: flex; flex-direction: column;
}

/* 公用 */
.hidden { display: none !important; }

/* 頂部列 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  height: 64px; background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
}
/* 取代原本的 .logo 規則 */
.logo {
  height: 36px;          /* 固定高度 */
  width: auto;           /* 寬度自動，維持比例 */
  /*max-width: 67px;       /* 你原先想要的大致寬度上限 */
  border-radius: 6px;
  display: block;
  object-fit: contain;   /* 避免裁切，保持比例 */
}

.brand .title { font-weight: 600; }
.brand .subtitle { font-size: 12px; color: var(--muted); }

/* 主體與訊息清單 */
.main {
  flex: 1;
  display: flex; flex-direction: column; align-items: center;
  padding: 12px;
}
.messages {
  width: 100%; max-width: 820px;
  height: calc(100vh - 64px - 72px);
  height: calc(100dvh - 64px - 72px);
  overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}

/* 單則訊息 */
.msg { display: flex; align-items: flex-start; gap: 10px; }
.msg.user { flex-direction: row-reverse; }
.avatar {
  width: 36px; height: 36px; border-radius: 999px;
  background: #fff; border: 1px solid var(--border); flex-shrink: 0;
}

/* 泡泡 */
.bubble {
  max-width: 78%;
  border: 1px solid var(--border); border-radius: 16px;
  padding: 10px 12px;
  background: var(--bubble-bot); color: var(--bubble-bot-text);
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  font-size: 14px; line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.user .bubble {
  background: var(--bubble-user);
  color: var(--bubble-user-text);
  border-color: transparent;
}

/* 思考中動畫 */
.thinking {
  width: 100%; max-width: 820px;
  display: flex; align-items: center; gap: .5rem;
  margin-top: 8px; padding: .6rem .8rem;
  border-radius: 12px; background: #f6f7fb; color: #4b5563;
  border: 1px dashed var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  font-size: 14px;
}
.thinking .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: .35; display: inline-block;
  animation: dotBounce 1.05s infinite ease-in-out;
}
.thinking .dot:nth-child(1) { animation-delay: 0s; }
.thinking .dot:nth-child(2) { animation-delay: .15s; }
.thinking .dot:nth-child(3) { animation-delay: .3s; }
@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: .35; }
  40% { transform: scale(1); opacity: 1; }
}

/* 骨架（可選） */
.skeleton {
  background: linear-gradient(90deg, #eee 25%, #f6f6f6 37%, #eee 63%);
  background-size: 400% 100%; animation: shimmer 1.25s infinite;
  border-radius: 10px; height: 1.1em; width: 60%;
}
@keyframes shimmer { 0% {background-position: 100% 0;} 100% {background-position: -100% 0;} }

/* 輸入列 */
.composer {
  min-height: 72px;
  height: auto;
  background: var(--panel);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  justify-content: center;
}
.composer .input {
  width: 100%; max-width: 620px;
  min-height: 40px;
  max-height: 120px;
  height: auto;
  padding: 8px 12px;
  line-height: 1.4;
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: none;
  overflow-y: auto;
  resize: none;
  white-space: pre-wrap;
  word-break: break-word;
}
.btn {
  height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-outline { background: #f3f4f6; border-color: var(--border); }
.btn-outline:hover { background: #e9ecf1; }

/* 行動裝置微調 */
@media (max-width: 480px) {
  .bubble { max-width: 86%; }
  .messages { padding: 12px; }
}




