:root{
  --bg:#f3f4f6;
  --panel:#ffffff;
  --border:#e5e7eb;
  --shadow: 0 10px 25px rgba(0,0,0,.08);
  --text:#111827;
  --muted:#6b7280;

  --user:#2563eb;
  --bot:#f1f5f9;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, "Noto Sans TC", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app{
  min-height:100vh;
  display:flex;
  flex-direction:column;
  align-items:center;
  padding: 24px 12px;
}

.app__header{
  width:100%;
  display:flex;
  justify-content:center;
  margin-bottom: 14px;
}

.app__title{
  margin:0;
  font-size: 22px;
  font-weight: 700;
}

.chat{
  width: min(600px, 100%);
  min-width: 300px;             /* (11) 最小寬 */
  background: var(--panel);
  border:1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.chat__body{
  height: 520px;
  padding: 16px 14px;
  overflow-y:auto;
  background: #fafafa;
}

.msg{
  display:flex;
  margin: 10px 0;
}

.msg--bot{ justify-content:flex-start; }
.msg--user{ justify-content:flex-end; }

.bubble{
  max-width: 78%;
  border-radius: 14px;
  padding: 10px 12px;
  border:1px solid var(--border);
  position:relative;
}

.msg--bot .bubble{
  background: var(--bot);
}

.msg--user .bubble{
  background: var(--user);
  color:#fff;
  border-color: rgba(255,255,255,.25);
}

.text{
  line-height: 1.35;
  font-size: 15px;
  word-break: break-word;
}

.time{
  margin-top: 6px;
  font-size: 12px;
  opacity:.75;
  color: var(--muted);
}

.msg--user .time{
  color: rgba(255,255,255,.85);
}

.imgWrap{
  margin-top: 6px;
}
.imgWrap img{
  display:block;
  max-width: 100%;
  border-radius: 10px;
  border:1px solid rgba(0,0,0,.08);
}

.chat__composer{
  display:flex;
  gap: 10px;
  padding: 12px;
  border-top:1px solid var(--border);
  background:#fff;
  align-items:center;
}

.chat__input{
  flex:1;
  height: 42px;
  border-radius: 999px;
  border:1px solid var(--border);
  padding: 0 14px;
  font-size: 15px;
  outline:none;
}
.chat__input:focus{
  border-color:#93c5fd;
  box-shadow: 0 0 0 4px rgba(147,197,253,.35);
}

.iconBtn, .sendBtn{
  border:none;
  background:#f3f4f6;
  height: 42px;
  min-width: 42px;
  border-radius: 999px;
  cursor:pointer;
  font-size: 18px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.iconBtn:hover, .sendBtn:hover{ filter: brightness(.98); }
.iconBtn:active, .sendBtn:active{ transform: translateY(1px); }

.hidden{ display:none; }

/* 響應式：小螢幕高度稍微縮短 */
@media (max-width: 420px){
  .chat__body{ height: 460px; }
  .bubble{ max-width: 84%; }
}
