:root {
  color-scheme: dark;
  --bg: #0f1112;
  --panel: #171a1c;
  --line: #2a2e31;
  --ink: #e9e3da;
  --muted: #9b948a;
  --accent: #d8b892;
  --user: #24282b;
  --assistant: #1d2022;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 0%, #1b1f21 0, transparent 45%),
    radial-gradient(circle at 85% 100%, #1a1d1f 0, transparent 40%),
    var(--bg);
  color: var(--ink);
  font: 15px/1.75 "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
}

.public-app {
  width: min(860px, 100%);
  min-height: 100%;
  margin: 0 auto;
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.public-header { padding: 4px 4px 8px; border-bottom: 1px solid var(--line); }
.brand { font-size: 20px; letter-spacing: .06em; }
.sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.account { color: var(--muted); font-size: 11px; margin-top: 2px; opacity: .85; }

.public-messages {
  flex: 1;
  min-height: 45vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 2px;
  overflow-y: auto;
}

.msg { display: flex; flex-direction: column; gap: 4px; max-width: 82%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg.assistant { align-self: flex-start; align-items: flex-start; }
.who { color: var(--muted); font-size: 11px; padding: 0 4px; }
.bubble {
  padding: 10px 14px;
  border-radius: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
}
.msg.user .bubble { background: var(--user); border-bottom-right-radius: 4px; }
.msg.assistant .bubble { background: var(--assistant); border-bottom-left-radius: 4px; }

.typing { color: var(--muted); font-size: 13px; padding-left: 6px; }
.error { color: #e0a28f; font-size: 12px; padding: 0 6px; }

.public-composer {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: linear-gradient(transparent, var(--bg) 40%);
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
textarea {
  flex: 1;
  resize: none;
  min-height: 48px;
  max-height: 180px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  outline: none;
}
textarea:focus { border-color: var(--accent); }
button {
  height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #1b1712;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: .55; cursor: default; }
button:hover:not(:disabled) { filter: brightness(1.05); }

@media (max-width: 640px) {
  .public-app { padding: 14px 12px; }
  .msg { max-width: 92%; }
  .public-header .sub { line-height: 1.5; }
}
