/* =========================
   KaiGI Core UI Reset
   端末差・iOSバグ・ズーム暴れ対策
   ========================= */

/* --- ベースリセット --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0b0b0c;
  color: #fff;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

/* --- iOSズーム防止（入力時の画面暴れ軽減） --- */
input, textarea, button {
  font-size: 16px; /* これ未満だとiOSが勝手にズーム */
}

/* --- アプリ全体レイアウト --- */
body {
  display: flex;
  flex-direction: column;
  height: var(--app-h, 100vh);
}

/* --- ノッチ安全エリア対応 --- */
.safe-top {
  padding-top: env(safe-area-inset-top);
}
.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

/* =========================
   HEADER
   ========================= */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10,10,11,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 12px 14px;
}

/* =========================
   メインチャット領域
   ========================= */
.wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 900px;   /* PCでも広く */
  margin: 0 auto;
  padding: 12px;
  gap: 10px;
}

/* --- チャット表示領域（最大化） --- */
.timeline {
  flex: 1;
  overflow-y: auto;
  background: rgba(20,20,22,.55);
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
  padding: 12px;
}

/* --- メッセージ行 --- */
.row {
  display: flex;
  margin: 8px 0;
}

.row.user {
  justify-content: flex-end;
}

.row.bot {
  justify-content: flex-start;
}

/* --- 吹き出し --- */
.bubble {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble.user {
  background: linear-gradient(180deg,#1f5eff,#1748d2);
}

.bubble.bot {
  background: #2a2a2f;
}

/* =========================
   入力エリア
   ========================= */
.composer {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(10,10,11,.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.08);
}

input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.08);
  color: #fff;
}

button {
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  background: #2ea043;
  color: #0b0b0c;
  font-weight: bold;
  cursor: pointer;
}

button:active {
  transform: translateY(1px);
}

/* =========================
   スクロールバー最小化
   ========================= */
.timeline::-webkit-scrollbar {
  width: 6px;
}
.timeline::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.15);
  border-radius: 4px;
