:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #202523;
  background: #fcfdfa;
  --text: #202523;
  --muted: #5b665f;
  --accent: #214c41;
  --line: #dbe3dd;
  --soft: #edf3ee;
  --width: 720px;
  --header: 64px;
}
* { box-sizing: border-box; }
[hidden], .symbols { display: none !important; }
body { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topbar {
  position: sticky; top: 0; z-index: 2; height: var(--header);
  display: flex; justify-content: space-between; align-items: center; padding: 0 28px;
  background: #fcfdfa; border-bottom: 1px solid #e8ede8;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: .01em; }
.brand-icon { color: var(--accent); width: 19px; height: 19px; }
.badge { border: 1px solid #dce7de; padding: 2px 7px; border-radius: 20px; font-size: 11px; font-weight: 500; color: var(--accent); }
.new-chat, .starters button, .actions button, .dialog-actions button {
  background: transparent; border: 1px solid var(--line); color: var(--text); border-radius: 10px;
}
.new-chat { display: inline-flex; gap: 5px; align-items: center; padding: 6px 10px; font-size: 13px; }
.new-chat svg { width: 16px; height: 16px; }
.new-chat:hover, .starters button:hover, .actions button:hover, .dialog-actions button:hover { background: var(--soft); }
.gate, .chat { min-height: calc(100dvh - var(--header)); }
.gate, .welcome { text-align: center; }
.gate { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 20px 100px; }
.emblem {
  display: grid; place-items: center; width: 55px; height: 55px; margin: 0 auto 22px;
  color: var(--accent); background: #e9f1ea; border-radius: 17px;
}
.emblem svg { width: 29px; height: 29px; stroke-width: 1.45; }
h1 { margin: 0; font-size: clamp(27px, 6vw, 38px); line-height: 1.24; letter-spacing: -.045em; font-weight: 680; }
.intro { margin: 13px 0 0; color: var(--muted); font-size: 15px; line-height: 1.7; }
.invite-form { width: min(100%, 385px); margin: 30px 0 0; text-align: left; }
.invite-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.invite-row { display: flex; gap: 8px; }
.invite-row input {
  min-width: 0; flex: 1; border-radius: 12px; padding: 11px 13px; border: 1px solid var(--line); background: #fff;
}
.invite-row button, .send, .dialog-actions button[value="reset"] { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.invite-row button { padding: 10px 15px; border-radius: 12px; font-size: 14px; white-space: nowrap; }
.invite-row button:hover, .send:not(:disabled):hover { background: #173e34; }
.chat { display: flex; flex-direction: column; }
.welcome {
  flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 62px 22px 35px;
}
.starters { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.starters button { padding: 8px 12px; font-size: 13px; }
.messages { width: min(var(--width), calc(100% - 40px)); margin: 0 auto; flex: 1; padding-top: 25px; }
.messages:empty { display: none; }
.message { margin: 0 0 28px; line-height: 1.85; overflow-wrap: anywhere; font-size: 15px; }
.message.user { display: flex; justify-content: end; }
.bubble { max-width: min(89%, 590px); background: var(--soft); padding: 10px 15px; border-radius: 17px; white-space: pre-wrap; }
.message.assistant { padding-inline: 2px; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 12px; }
.prose h2, .prose h3, .prose h4 { margin: 20px 0 8px; line-height: 1.55; }
.prose h2 { font-size: 1.24em; }
.prose h3, .prose h4 { font-size: 1.1em; }
.prose pre { background: #f1f5f1; border: 1px solid var(--line); border-radius: 12px; padding: 14px; white-space: pre-wrap; }
.prose blockquote { border-inline-start: 3px solid #b6cbbd; padding-inline-start: 12px; color: var(--muted); margin: 8px 0 12px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.actions button { font-size: 12px; padding: 4px 9px; color: var(--muted); }
.pending { color: var(--muted); font-size: 14px; }
.notice { color: #8e3828; font-size: 13px; margin: 8px 0; }
.notice:empty { display: none; }
.notice button { font: inherit; color: inherit; margin-left: 8px; background: transparent; border: 0; text-decoration: underline; }
.composer-area {
  position: sticky; bottom: 0; width: min(var(--width), calc(100% - 40px)); margin: auto auto 0;
  padding: 11px 0 max(10px, env(safe-area-inset-bottom)); background: #fcfdfa;
}
.composer {
  display: flex; gap: 10px; align-items: flex-end; padding: 9px; border-radius: 23px;
  border: 1px solid #d5ded6; background: #fff; box-shadow: 0 3px 10px #1b36210a;
}
.composer:focus-within { border-color: #81a28f; }
.composer textarea { flex: 1; width: 100%; min-height: 38px; max-height: 170px; padding: 7px 6px 7px 11px; border: 0; outline: none; resize: none; line-height: 24px; background: transparent; color: var(--text); }
.composer textarea:focus-visible { outline: none; }
.send { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; flex: 0 0 auto; }
.send:focus-visible { outline-offset: 2px; }
.send:disabled { background: #e7ede8; color: #66756b; border-color: #e7ede8; }
.send svg { width: 20px; height: 20px; }
.footnote { margin: 8px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
dialog { border: 1px solid var(--line); border-radius: 17px; width: min(420px, calc(100% - 32px)); padding: 22px; color: var(--text); }
dialog::backdrop { background: #14261d55; }
dialog h2 { font-size: 19px; margin: 0; }
dialog p { color: var(--muted); font-size: 14px; line-height: 1.7; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.dialog-actions button { font-size: 13px; padding: 8px 11px; }
@media (max-width: 560px) {
  :root { --header: 54px; }
  .topbar { padding-inline: 15px; }
  .messages, .composer-area { width: calc(100% - 28px); }
  .welcome { padding-top: 36px; }
  .bubble { max-width: 93%; }
  .footnote { font-size: 11px; }
}
.message { scroll-margin-top: calc(var(--header) + 20px); }
.actions .confirm-images {
  padding: 7px 12px; color: #fff; background: var(--accent); border-color: var(--accent);
}
.actions .confirm-images:hover { background: #173e34; }
.actions .confirm-images:disabled { opacity: .55; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; }
.image-grid figure { margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); font-size: 13px; }
.image-grid img { display: block; width: 100%; height: auto; border-radius: 8px; }
.image-grid a { display: block; margin-top: 5px; color: var(--accent); }
@media (max-width: 520px) {
  .image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
