/* 토닥 채팅 PWA — todak/ 디자인 언어 계승(편지지 · 한 가지 클레이 · 헤어라인) */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); -webkit-font-smoothing: antialiased;
}
.app { max-width: var(--maxw); margin: 0 auto; height: 100dvh; display: flex; flex-direction: column; }

.screen { display: none; flex: 1; min-height: 0; flex-direction: column; }
.screen.on { display: flex; }

/* ── 웰컴 / 로그인 ── */
.hero { padding: 48px 24px 32px; display: flex; flex-direction: column; gap: 14px; }
.brand { color: var(--primary); font-weight: 800; font-size: 22px; letter-spacing: -0.3px; }
.brand.sm { font-size: 18px; }
.hero h1 { margin: 6px 0 0; font-size: 32px; line-height: 1.25; letter-spacing: -0.5px; }
.hero h2 { margin: 6px 0 0; font-size: 24px; letter-spacing: -0.3px; }
.lead { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.promises { margin: 8px 0 0; padding: 14px 16px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); display: grid; gap: 8px; }
.promises li { font-size: 13.5px; line-height: 1.6; color: var(--muted); padding-left: 14px; position: relative; }
.promises li::before { content: ""; position: absolute; left: 0; top: 9px; width: 5px; height: 5px; border-radius: 50%; background: var(--primary); }
.promises b { color: var(--ink); }
.agree { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); margin-top: 4px; }
.agree input { width: 18px; height: 18px; accent-color: var(--primary); }

.btn { border: 0; border-radius: var(--r-sm); padding: 14px 18px; font-size: 15.5px; font-weight: 700; font-family: inherit; cursor: pointer; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:disabled { opacity: 0.5; }
.hint { min-height: 20px; margin: 0; font-size: 13px; color: var(--muted); }
.linklike { background: none; border: 0; color: var(--muted); font-size: 12.5px; cursor: pointer; font-family: inherit; text-decoration: underline; }

#login-form { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
#login-form input { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-sm); padding: 14px 15px; font-size: 16px; font-family: inherit; color: var(--ink); }

/* ── 채팅 ── */
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 10px; border-bottom: 1px solid var(--line); }
.who-wrap { display: flex; align-items: center; gap: 10px; }
.who { font-size: 12px; color: var(--faint); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.today { border-bottom: 1px solid var(--line); background: var(--surface); }
.today-head { width: 100%; text-align: left; background: none; border: 0; padding: 10px 18px; font-size: 13px; color: var(--muted); font-family: inherit; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.today-head b { color: var(--primary); }
.today-head .chev { margin-left: auto; transition: transform 0.15s; }
.today.open .today-head .chev { transform: rotate(180deg); }
.today ul { display: none; margin: 0; padding: 0 18px 10px; list-style: none; max-height: 34dvh; overflow-y: auto; }
.today.open ul { display: block; }
.today li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.today li:first-child { border-top: 0; }
.today li .q { flex: 1; line-height: 1.5; }
.today li.empty { color: var(--faint); }
.today .drop { background: none; border: 1px solid var(--line); border-radius: 20px; padding: 3px 10px; font-size: 11.5px; color: var(--muted); cursor: pointer; font-family: inherit; white-space: nowrap; }

.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; flex-direction: column; }
.msg.me { align-items: flex-end; }
.msg.todak { align-items: flex-start; }
.bubble { max-width: 82%; padding: 11px 14px; border-radius: var(--r); font-size: 15px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.msg.me .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 6px; }
.msg.todak .bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bubble.typing { color: var(--faint); }
.msg .dup { font-size: 11.5px; color: var(--faint); margin-top: 4px; }
.msg.sys { align-items: center; }
.msg.sys, .msg.sys * { font-size: 13px; color: var(--muted); text-align: center; line-height: 1.6; max-width: 90%; }

.composer { display: flex; gap: 8px; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.composer input { flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: 22px; padding: 12px 16px; font-size: 16px; font-family: inherit; color: var(--ink); min-width: 0; }
.composer .btn { border-radius: 22px; padding: 12px 18px; }
