:root {
  --bg: #f6f4f1;
  --fg: #222;
  --muted: #777;
  --line: #ddd8d0;
  --me: #2d6a4f;
  --me-fg: #fff;
  --her: #fff;
  --accent: #2d6a4f;
  --err: #b42318;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #17181a; --fg: #e8e6e3; --muted: #9a978f; --line: #34363a; --me: #3f8f6b; --her: #232528; --accent: #5fb38c; --err: #f97066; }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: "Noto Sans JP", system-ui, sans-serif; font-size: 16px; line-height: 1.6;
  display: flex; flex-direction: column;
}
.center { margin: auto; max-width: 420px; padding: 24px 16px; text-align: center; }
h1 { font-size: 22px; margin: 0 0 4px; }
.sub, .note { color: var(--muted); font-size: 13px; }
.note { margin-top: 20px; }
.err { color: var(--err); font-size: 14px; }
.btn {
  appearance: none; border: 0; border-radius: 10px; background: var(--accent); color: #fff;
  font: inherit; font-weight: 700; padding: 10px 18px; cursor: pointer;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn--sub { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.center .btn { margin-top: 20px; width: 100%; }
.link { appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; padding: 4px 6px; }

.bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0;
}
.bar .title { font-weight: 700; }
.bar .tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.bar #reset { margin-left: auto; }

.log { flex: 1; overflow-y: auto; padding: 16px; max-width: 720px; width: 100%; margin: 0 auto; }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 24px 0; }
.msg { display: flex; margin: 10px 0; }
.msg p {
  margin: 0; padding: 8px 12px; border-radius: 14px; max-width: 80%;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.me { justify-content: flex-end; }
.msg.me p { background: var(--me); color: var(--me-fg); border-bottom-right-radius: 4px; }
.msg.her p { background: var(--her); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.her .who { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.msg.wait p { color: var(--muted); }
.msg.fail p { color: var(--err); border-color: var(--err); }

.send {
  display: flex; gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); max-width: 720px; width: 100%; margin: 0 auto;
}
.send textarea {
  flex: 1; resize: none; font: inherit; color: var(--fg); background: var(--her);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; max-height: 120px;
}
