:root {
  --line-green: #06c755;
  --line-bg: #f2f2f7;
  --chat-bg: #8cabd8;
  --text-primary: #111;
  --text-muted: #6b6b6b;
  --panel: #fff;
  --border: #e5e5ea;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'LINE Seed JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--line-bg);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
}
button, input, textarea { font: inherit; }
.hidden { display:none !important; }
.intro {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.intro-card {
  max-width: 560px;
  background: var(--panel);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 30px rgba(0,0,0,.08);
}
.intro h1 { margin-top: 0; }
.notice { white-space: pre-line; color: #333; line-height: 1.7; }
.start-btn {
  margin-top: 16px;
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  background: var(--line-green);
  color: #fff;
  font-weight: 700;
}
.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}
.sidebar {
  border-right: 1px solid var(--border);
  background: #fff;
  display:flex;
  flex-direction:column;
  min-height: 0;
}
.sidebar-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.friend-add-row { display:flex; gap:8px; }
.friend-input { flex:1; border:1px solid var(--border); border-radius:8px; padding:8px 10px; height: 36px; line-height: 1.2; }
.btn {
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  background: #f1f2f4;
  cursor: pointer;
}
.btn-primary { background: var(--line-green); color:#fff; }
.error { color:#d93025; font-size:12px; margin-top:6px; }
.chat-list { overflow:auto; flex:1; }
.chat-item {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  display:flex;
  gap:10px;
  background:#fff;
  width:100%;
  text-align:left;
}
.chat-item.active { background:#eef8f1; }
.avatar { width:48px; height:48px; border-radius:50%; object-fit:cover; background:#ddd; }
.chat-meta { min-width:0; width: 100%; }
.chat-name { font-weight:700; }
.chat-preview { color:var(--text-muted); font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chat-item-head { display: flex; align-items: flex-start; gap: 8px; width: 100%; }
.chat-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.chat-time { margin-left: auto; text-align: right; }
.sidebar-footer { padding:10px 12px; border-top:1px solid var(--border); display:flex; gap:8px; }
.chat-panel { display:flex; flex-direction:column; background:var(--chat-bg); }
.chat-panel { min-height: 0; }
.chat-top {
  background:#fff;
  border-bottom:1px solid var(--border);
  padding:10px 12px;
  display:flex;
  gap:8px;
  align-items:center;
}
.back-btn { display:none; }
.chat-title { font-weight:700; }
.messages {
  flex:1;
  overflow:auto;
  padding:14px 12px 4px;
  min-height: 0;
}
.msg-row { margin-bottom: 10px; display:flex; }
.msg-row.user { justify-content:flex-end; }
.msg-row.bot { justify-content:flex-start; }
.msg-row > div { display: flex; flex-direction: column; }
.msg-main { display: flex; align-items: flex-end; gap: 6px; }
.bubble {
  max-width: 50ch;
  border-radius:16px;
  padding: 9px 12px;
  line-height:1.45;
  word-break:break-word;
  white-space: pre-wrap;
}
.msg-row.user .bubble { background: #91e68a; }
.msg-row.bot .bubble { background:#fff; }
.msg-sender {
  display:flex; align-items:center; gap:8px; margin-bottom:4px; font-size:12px;
}
.msg-sender .avatar { width:24px; height:24px; }
.msg-meta {
  font-size: 11px;
  color: rgba(0, 0, 0, 0.58);
  margin-bottom: 2px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 28px;
}
.msg-row.user .msg-meta { justify-content: flex-start; }
.msg-row.bot .msg-meta { justify-content: flex-end; }
.quick-replies { display:flex; gap:8px; flex-wrap:wrap; padding:4px 12px 4px; }
.quick-btn {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: #7d92b3;
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.input-area {
  background:#fff;
  border-top:1px solid var(--border);
  padding:8px;
  display:flex;
  gap:8px;
}
.chat-input {
  flex:1;
  border:1px solid var(--border);
  border-radius:18px;
  padding:10px 12px;
  resize: none;
  min-height: 40px;
  max-height: 180px;
  line-height: 1.4;
  overflow-y: auto;
}
.empty {
  flex:1; display:grid; place-items:center; color:#666;
}
@media (max-width: 767px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display:flex; }
  .chat-panel { display:none; }
  .layout.mobile-chat .sidebar { display:none; }
  .layout.mobile-chat .chat-panel { display:flex; }
  .back-btn { display:inline-block; }
  .bubble { max-width: 70vw; }
}
