:root {
  --bg: #f6f7f9; --card: #fff; --text: #16181d; --muted: #6b7280; --line: #e5e7eb;
  --accent: #111; --accent-text: #fff; --mine: #111; --mine-text: #fff; --theirs: #fff; --danger: #b42318;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e0f12; --card: #17191e; --text: #eceef2; --muted: #9aa1ac; --line: #2a2d34;
    --accent: #eceef2; --accent-text: #0e0f12; --mine: #eceef2; --mine-text: #0e0f12; --theirs: #22252b; --danger: #f97066; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif; }
main { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 16px; }
h1 { font-size: 22px; margin: 28px 0 4px; }
p.hint { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input, textarea, select { width: 100%; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; }
textarea { resize: none; }
button { font: inherit; border: 0; border-radius: 10px; padding: 10px 16px; background: var(--accent); color: var(--accent-text); cursor: pointer; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.link { background: none; color: var(--muted); padding: 4px 6px; font-size: 13px; }
button:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; }
.row > input { flex: 1; }
.err { color: var(--danger); font-size: 14px; min-height: 1.5em; margin: 8px 0 0; }
.list .item { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.list .item:first-child { border-top: 0; }
.item .t { font-weight: 600; }
.item .s { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 70vw; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex: none; align-self: center; }
header.bar { position: sticky; top: 0; background: var(--bg); display: flex; align-items: center; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
header.bar .title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msgs { flex: 1; overflow-y: auto; padding: 12px 0; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 80%; padding: 8px 12px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.bubble.out { align-self: flex-end; background: var(--mine); color: var(--mine-text); }
.bubble.in { align-self: flex-start; background: var(--theirs); border: 1px solid var(--line); }
.meta { font-size: 12px; color: var(--muted); }
.meta.out { align-self: flex-end; }
.meta.in { align-self: flex-start; }
.banner { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; color: var(--muted); margin: 8px 0; }
footer.compose { position: sticky; bottom: 0; background: var(--bg); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: flex-end; }
footer.compose textarea { flex: 1; min-height: 44px; max-height: 160px; }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); width: min(92vw, 420px); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.menu { display: flex; flex-direction: column; gap: 8px; }
.row.gap { margin-top: 8px; }

p.legal-links { margin: 4px 0 12px; font-size: 12px; text-align: center; }
a { color: inherit; }
main.legal { display: block; max-width: 720px; padding-bottom: 48px; }
main.legal h2 { font-size: 18px; margin: 28px 0 8px; }
main.legal .table { overflow-x: auto; }
main.legal table { border-collapse: collapse; font-size: 14px; }
main.legal th, main.legal td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
.check { display: flex; gap: 8px; align-items: flex-start; }
.check > input { width: auto; margin-top: 4px; }
