:root {
  /* tokens from design/line-miniapp.html */
  --bg: #f2f4f7; --panel: #fff; --ink: #191c17; --muted: #6e7269; --hairline: #e4e2d9; --me: #cdf3ae; --sys: #ecebe4;
  --line: #06c755; --line-dark: #059b43; --line-soft: #eaf9f0; --danger: #d64545;
  --font: 17px/1.45 "IBM Plex Sans Thai Looped", -apple-system, "Sukhumvit Set", "Noto Sans Thai", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); font: var(--font); }
body { display: flex; flex-direction: column; }

#top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--panel); border-bottom: 1px solid var(--hairline); position: sticky; top: 0; }
.members { display: flex; gap: 6px; flex: 1; overflow-x: auto; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.member { display: flex; flex-direction: column; align-items: center; font-size: 12px; color: var(--muted); min-width: 44px; white-space: nowrap; }
.pill { border: 0; border-radius: 999px; background: var(--line); color: #fff; padding: 8px 14px; font: inherit; font-weight: 600; }
.pill.ghost { background: #e5e7eb; color: var(--ink); }
.pill[disabled] { opacity: .5; }

#chat { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 8px; align-items: flex-end; max-width: 86%; }
.row.me { align-self: flex-end; flex-direction: row-reverse; }
.bubble { background: var(--panel); padding: 10px 14px; border-radius: 18px; border-bottom-left-radius: 4px; box-shadow: 0 1px 1px rgba(0,0,0,.05); white-space: pre-wrap; word-break: break-word; }
.row.me .bubble { background: var(--me); border-radius: 18px; border-bottom-right-radius: 4px; }
.name { font-size: 12px; color: var(--muted); margin: 0 0 2px 4px; }
.sys { align-self: center; font-size: 13px; color: var(--muted); background: var(--sys); padding: 4px 12px; border-radius: 999px; }

.typing { padding: 4px 16px; font-size: 14px; color: var(--muted); min-height: 24px; }
@media (prefers-reduced-motion: no-preference) { .typing::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #b8bcb6; margin-right: 8px; animation: zb 1.2s infinite; } }
@keyframes zb { 0%, 80%, 100% { opacity: .3 } 40% { opacity: 1 } }
#composer { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid #e3e6ea; }
#input { flex: 1; font: inherit; padding: 12px 14px; border: 1px solid #d1d5db; border-radius: 999px; }
#composer button { width: 48px; border: 0; border-radius: 50%; background: var(--line); color: #fff; font-size: 18px; }

.sheet { position: fixed; inset: auto 0 0 0; max-height: 88vh; overflow-y: auto; background: var(--panel); border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(0,0,0,.15); }
.sheet h2 { margin: 0 0 12px; font-size: 20px; }
.q { margin: 14px 0; }
.q .t { font-weight: 600; margin-bottom: 8px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opts label { border: 1.5px solid #d1d5db; border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.opts input { display: none; }
.opts input:checked + span { color: var(--line-dark); font-weight: 700; }
.opts label:has(input:checked) { border-color: var(--line); background: var(--line-soft); }
.muted { color: var(--muted); font-size: 14px; }
.cand { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid #eee; }
.cand .info { flex: 1; }
.cand .intro { font-size: 14px; color: var(--muted); }
.status { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); background: #111; color: #fff; padding: 6px 14px; border-radius: 999px; font-size: 13px; }

.reacts { display: flex; gap: 4px; margin: 2px 0 0 6px; font-size: 14px; }
.reacts span { background: var(--panel); border: 1px solid #e3e6ea; border-radius: 999px; padding: 0 6px; }
.member { user-select: none; -webkit-user-select: none; }
