:root { --navy: #23255C; --gold: #B07A12; --bg: #F6F5EF; --line: #E2DFD2; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Noto Sans JP", -apple-system, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: var(--bg); color: #222; line-height: 1.7; font-size: 15px;
  overflow-x: hidden; min-height: 100vh; display: flex; flex-direction: column;
}
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: var(--navy); color: #fff;
}
.top-name { font-weight: 700; letter-spacing: .08em; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #fff; flex: none; }
.unseen {
  position: sticky; top: 52px; z-index: 4; width: 100%; border: 0; cursor: pointer;
  background: var(--gold); color: #fff; font: inherit; font-weight: 700; padding: 8px;
}
.chat { flex: 1; padding: 14px 12px 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.row { display: flex; gap: 8px; max-width: 100%; }
.row.me { justify-content: flex-end; }
.bubble {
  max-width: 82%; padding: 9px 13px; border-radius: 16px; overflow-wrap: anywhere;
  white-space: pre-wrap; word-break: break-word;
}
.me .bubble { background: var(--navy); color: #fff; border-bottom-right-radius: 4px; }
.sai .bubble, .mouten .bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.sai .avatar, .mouten .avatar { align-self: flex-start; }
.col { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: 82%; }
.col .bubble { max-width: 100%; }
.me-col { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 82%; min-width: 0; }
.me-col .bubble { max-width: 100%; }
.badge { font-size: 12px; color: #666; }
.mouten .bubble { border-color: var(--gold); }
.heading { font-weight: 700; color: var(--gold); font-size: 13px; }
.draft-box { margin-top: 8px; border: 1px dashed var(--gold); border-radius: 10px; background: #FBF7EA; padding: 8px 10px; }
.draft-label { font-size: 12px; font-weight: 700; color: var(--gold); }
.draft-text { margin: 4px 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; user-select: text; }
.copy {
  border: 1px solid var(--gold); background: #fff; color: var(--gold); border-radius: 999px;
  font: inherit; font-size: 13px; padding: 2px 14px; cursor: pointer;
}
.flag { align-self: flex-start; font-size: 12px; color: #777; background: none; border: 0; padding: 0 4px; text-decoration: underline; cursor: pointer; font-family: inherit; }
.flag[disabled] { text-decoration: none; cursor: default; }
.notice { font-size: 13px; color: #666; padding-left: 44px; }
.composer { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
.error { margin: 0 0 6px; color: #B3261E; font-size: 13px; }
.form { display: flex; align-items: flex-end; gap: 8px; }
.cam { font-size: 22px; cursor: pointer; padding: 4px 6px; flex: none; }
.form textarea {
  flex: 1; min-width: 0; resize: none; font: inherit; font-size: 16px; max-height: 120px;
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px;
}
.send { flex: none; border: 0; border-radius: 12px; background: var(--navy); color: #fff; font: inherit; font-weight: 700; padding: 9px 16px; cursor: pointer; }
.send[disabled] { opacity: .5; }
.previews { display: flex; gap: 6px; flex-wrap: wrap; }
.previews:not(:empty) { margin-bottom: 6px; }
.previews span { font-size: 12px; background: var(--bg); border-radius: 8px; padding: 2px 8px; }
.name-form { display: flex; gap: 8px; margin-top: 8px; }
.name-form input { flex: 1; min-width: 0; font: inherit; font-size: 16px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
