:root { --fg:#22261f; --mut:#646a5c; --line:#dde1d4; --bd:#c6ccb9; --acc:#2f6b45; color-scheme: light; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #fbfbf8; color: var(--fg); font: 16px/1.45 "Malgun Gothic", sans-serif; }
main { max-width: 420px; margin: 0 auto; height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: #efe4cf; }
#status { margin: 0; padding: 8px 14px; background: #fff; color: var(--mut); font-size: 13px; border-bottom: 1px solid var(--line); }
#view { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
header { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); }
header b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button, input, textarea { font: inherit; color: inherit; }
button { background: #fff; border: 1px solid var(--bd); border-radius: 8px; padding: 8px 12px; }
.go { background: var(--acc); border-color: var(--acc); color: #fff; }
.list { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.list button { text-align: left; padding: 14px; }
.list small { display: block; color: var(--mut); font-size: 13px; }
dialog { border: 1px solid var(--bd); border-radius: 12px; padding: 16px; max-width: 360px; }
dialog h2 { margin: 0 0 12px; font-size: 18px; }
label { display: block; margin: 0 0 10px; font-size: 13px; color: var(--mut); }
label input { display: block; width: 100%; margin-top: 4px; border: 1px solid var(--bd); border-radius: 8px; padding: 8px; color: var(--fg); }
.hint { color: var(--mut); font-size: 13px; }
.mut { color: var(--mut); font-size: 13px; }
.row { display: flex; justify-content: flex-end; gap: 8px; }
#find { margin: 12px 12px 0; border: 1px solid var(--bd); border-radius: 8px; padding: 8px; background: #fff; }
.list h3 { margin: 8px 2px 0; font-size: 14px; color: var(--mut); }

/* 채팅창: 앱의 리모컨 화면(sinabrain-app ui/app.css의 #msgs · .m · .peer · .note · .pic · .md)과 같은 모양을 핸드폰 폭에 맞춘다 */
#log { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 12px; background: #fff; }
#msgs { display: flex; flex-direction: column; gap: 12px; font-size: 15px; line-height: 1.5; }
.m { max-width: 84%; padding: 9px 13px; border-radius: 13px; background: #f2f4ed; align-self: flex-start; overflow-wrap: anywhere; min-width: 0; }
.m.me { align-self: flex-end; position: relative; border-radius: 16px 16px 4px 16px; max-width: 78%; background: #dfecd9; }
.m.me > .tm { position: absolute; right: 100%; bottom: 2px; margin-right: 6px; font-size: 11px; color: #8a9082; white-space: nowrap; }
.m:has(table), .m:has(.pic) { max-width: 100%; }
.pre { white-space: pre-wrap; }
.note { align-self: center; text-align: center; color: var(--mut); font-size: 12.5px; max-width: 90%; overflow-wrap: anywhere; white-space: pre-wrap; }
.av { flex: none; width: 30px; height: 30px; border-radius: 10px; background: #dfe6d2; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #4d5a3c; }
.m.a { background: none; padding: 0 0 0 38px; max-width: 100%; width: 100%; position: relative; }
.m.a .hd { display: flex; gap: 7px; align-items: baseline; margin-bottom: 2px; font-size: 12px; color: var(--mut); }
.m.a .hd b { font-size: 13.5px; color: var(--fg); }
.m.a .hd .av { position: absolute; left: 0; top: 1px; }
.m.peer { background: #fff; border: 1px solid #e3e0d4; border-radius: 14px; box-shadow: 0 1px 3px rgba(60,50,30,.07); padding: 0; max-width: 100%; width: 100%; overflow: hidden; }
.peer .top { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid #efede4; background: #faf9f5; font-size: 13.5px; }
.peer .av { width: 26px; height: 26px; border-radius: 50%; background: #efe5cd; color: #8b6b2f; font-size: 12px; }
.peer .top b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peer .k { font-size: 12px; color: #8b8069; white-space: nowrap; }
.peer .top .tm { margin-left: auto; font-size: 11px; color: #8a9082; white-space: nowrap; }
.peer .md { padding: 9px 12px; }
.peer .md.clip { max-height: 64px; padding-bottom: 0; overflow: hidden; -webkit-mask-image: linear-gradient(#000 65%, transparent); mask-image: linear-gradient(#000 65%, transparent); }
.mo { border: 0; background: none; color: #8b6b2f; font-size: 12.5px; font-weight: 700; padding: 2px 12px 8px; border-radius: 0; }
.md blockquote.fold { max-height: 3.1em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); margin-bottom: 0; }
.mo.qf { display: block; padding: 0 0 8px 0; }
/* 마크다운(앱과 같은 간격) · 표는 옆으로 밀어 본다 */
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 8px; } .md ul, .md ol { margin: 0 0 8px; padding-left: 22px; } .md li { margin: 2px 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 12px 0 6px; font-size: 15px; font-weight: 700; line-height: 1.4; } .md h1 { font-size: 17px; } .md h2 { font-size: 16px; }
.md code { font: 13px Consolas, "D2Coding", "Malgun Gothic", monospace; background: #e6e6d9; border-radius: 4px; padding: 1px 4px; } .md pre code { background: none; padding: 0; }
.md pre { background: #fbfaf4; padding: 8px; border-radius: 6px; overflow-x: auto; }
.md table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 0 0 8px; font-size: 13px; }
.md th, .md td { border: 1px solid #cfd4c5; padding: 4px 9px; text-align: left; vertical-align: top; background: #fff; } .md th { background: #e9ecdf; white-space: nowrap; }
.md blockquote { margin: 0 0 8px; padding-left: 10px; border-left: 3px solid var(--bd); color: #4d5347; } .md hr { border: 0; border-top: 1px solid var(--bd); }
.md a { color: var(--acc); } .md .pic { color: var(--mut); }
/* 대화의 이미지 */
.pw { display: inline-block; vertical-align: top; margin: 2px 6px 6px 0; }
img.pic { display: inline-block; vertical-align: top; max-width: 204px; max-height: 140px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
img.pic.wait { min-width: 120px; min-height: 80px; background: #e6e6d9; }
.gone { display: inline-block; vertical-align: top; max-width: 100%; margin: 2px 6px 6px 0; padding: 4px 9px; border: 1px dashed var(--bd); border-radius: 8px; overflow-wrap: anywhere; }
dialog#big { padding: 0; border: 0; border-radius: 0; width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; background: rgba(20,18,14,.92); }
dialog#big img { width: 100%; height: 100%; object-fit: contain; }
/* 쓰는 칸: 이미지 · 메시지 · 전송(앱의 sendRow) */
form#say { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: #fff; border-top: 1px solid var(--line); }
form#say .send { display: flex; gap: 8px; align-items: flex-end; }
form#say .send button { height: 44px; flex: none; }
#text { flex: 1; min-width: 0; resize: none; height: 44px; max-height: 120px; border: 1px solid var(--bd); border-radius: 10px; padding: 10px 12px; background: #fff; }
#pics { display: flex; flex-wrap: wrap; gap: 8px; max-height: 84px; overflow-y: auto; padding-top: 6px; }
.pv { position: relative; line-height: 0; }
.pv img { height: 64px; max-width: 120px; object-fit: cover; border-radius: 8px; border: 1px solid var(--bd); }
.pv button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; padding: 0; line-height: 1; }
