:root {
  color-scheme: light;
  font: 16px/1.55 "Geist", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #1b2441;
  background: #f7f8fc;
  --ink: #1b2441;
  --quiet: #5a6380;
  --line: #dce2f0;
  --paper: #f7f8fc;
  --rail: #edf0f9;
  --accent: #5041a6;
  --tint: #e7e3fa;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, select, input, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled, select:disabled { cursor: default; opacity: .55; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid #6050c4; outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); font-weight: 760; letter-spacing: .01em; }
.mark {
  display: inline-block; position: relative; flex: none; width: 34px; height: 34px; border-radius: 11px;
  background: #ded8fa; color: #4a3d9c;
}
.mark::before, .mark::after {
  content: ""; position: absolute; width: 37%; height: 37%; border: 1.5px solid currentColor;
  border-radius: 37% 37% 37% 12%; top: 28%; left: 22%;
}
.mark::after { left: 41%; top: 41%; background: #ded8fa; transform: rotate(180deg); }
.gate {
  min-height: 100dvh; display: grid; place-items: center; padding: 22px;
  background: radial-gradient(ellipse at 82% 9%, #e4defa 0, transparent 52%), var(--paper);
}
.login { width: min(100%, 440px); padding: clamp(24px, 7vw, 44px); border: 1px solid var(--line); border-radius: 26px; background: #fff; box-shadow: 0 20px 64px #24235212; }
.login h1 { font-size: clamp(1.55rem, 5vw, 2rem); letter-spacing: -.03em; margin: 28px 0 6px; }
.login p { color: var(--quiet); margin: 0 0 22px; }
.login form { display: grid; gap: 10px; margin: 0 0 19px; }
.login label { font-size: .87rem; font-weight: 650; }
.login input { border: 1px solid var(--line); border-radius: 12px; width: 100%; min-height: 46px; padding: 10px 13px; color: var(--ink); background: var(--paper); }
.primary { border: 0; background: var(--accent); color: #fff; min-height: 45px; border-radius: 12px; font-weight: 650; }
.demo-link { display: inline-flex; min-height: 44px; align-items: center; gap: 6px; text-underline-offset: 4px; font-size: .9rem; }
.room { height: 100vh; height: 100dvh; display: grid; grid-template-columns: 250px minmax(0, 1fr); overflow: hidden; }
.sidebar { display: flex; flex-direction: column; gap: 14px; min-height: 0; min-width: 0; padding: 23px 15px 13px; background: var(--rail); border-right: 1px solid var(--line); }
.sidebar .brand { padding: 0 7px 5px; }
.new-chat { border: 1px solid #d6d3eb; border-radius: 12px; color: #3e347f; background: #fafaff; text-align: left; padding: 10px 13px; min-height: 44px; font-size: .91rem; font-weight: 680; }
.new-chat:hover, .history-item:hover { background: #fff; }
.new-chat span { font-size: 1.1rem; margin-right: 6px; }
.sidebar h2 { color: var(--quiet); font-size: .76rem; font-weight: 650; margin: 6px 9px -7px; }
.history { flex: 1; min-height: 0; overflow: auto; padding: 3px; }
.history p { padding: 0 6px; color: var(--quiet); font-size: .83rem; }
.history-row { display: flex; align-items: center; margin: 2px 0; border-radius: 9px; }
.history-row.current { background: #e0dbf5; }
.history-item { border: 0; background: transparent; color: var(--ink); border-radius: 8px; padding: 9px 8px; text-align: left; min-width: 0; flex: 1; min-height: 44px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .87rem; }
.quiet { border: 0; color: var(--quiet); background: none; min-height: 44px; padding: 6px 8px; font-size: .85rem; border-radius: 7px; }
.quiet:hover { color: var(--accent); background: #ffffff8f; }
.sidebar-bottom { border-top: 1px solid var(--line); }
.sidebar-bottom p { color: var(--quiet); font-size: .76rem; padding: 2px 8px 0; margin: 12px 0 0; }
.main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.topbar { flex: none; min-height: 62px; display: flex; gap: 12px; align-items: center; padding: 0 26px; border-bottom: 1px solid var(--line); }
.top-title { min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: .92rem; font-weight: 660; }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font-size: 1.25rem; }
.icon-btn:hover { background: var(--rail); }
.menu-icon { width: 18px; height: 13px; border-top: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; position: relative; }
.menu-icon::after { content: ""; width: 13px; border-top: 1.6px solid currentColor; position: absolute; left: 0; top: 4px; }
.menu-btn, .mobile-new { display: none; }
.demo-banner { min-height: 38px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 5px 26px; background: #eeeafb; color: #4a3a85; font-size: .78rem; }
.demo-banner a { white-space: nowrap; }
.scroll-area { flex: 1; overflow-y: auto; overscroll-behavior-y: contain; display: flex; flex-direction: column; min-height: 0; }
.welcome { width: min(100%, 760px); padding: 30px 22px; margin: auto; text-align: center; }
.welcome-mark { width: 59px; height: 59px; border-radius: 20px; margin-bottom: 12px; }
.welcome-mark::before, .welcome-mark::after { border-width: 2px; }
.welcome h1 { font-size: clamp(1.6rem, 5vw, 2.65rem); letter-spacing: -.055em; margin: 0 0 23px; }
.suggestions { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.suggestion { min-height: 44px; max-width: 100%; border: 1px solid var(--line); background: #fff; color: #4a526f; padding: 8px 13px; border-radius: 11px; font-size: .84rem; }
.suggestion:hover { border-color: #a298d3; color: var(--accent); }
.messages { width: min(100%, 800px); margin: 0 auto; padding: 23px 20px; display: flex; flex-direction: column; gap: 19px; }
.messages:empty { display: none; }
.message { min-width: 0; max-width: 100%; }
.message.user { align-self: flex-end; max-width: min(86%, 580px); }
.message.assistant { align-self: flex-start; width: 100%; }
.message-label { margin-bottom: 5px; color: var(--quiet); font-size: .78rem; font-weight: 650; }
.message.user .message-label { text-align: right; }
.message-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .98rem; }
.user .message-body { background: #e8e5fa; padding: 10px 14px; border-radius: 15px 15px 4px 15px; }
.assistant .message-body { padding: 1px 0; line-height: 1.7; }
.message img { display: block; max-width: min(100%, 490px); max-height: 56dvh; width: auto; height: auto; border-radius: 14px; background: var(--rail); }
.message-actions { display: flex; gap: 7px; margin-top: 4px; align-items: center; }
.message-actions a { min-height: 44px; display: inline-flex; align-items: center; font-size: .85rem; text-underline-offset: 3px; }
.composer-area { padding: 0 20px max(8px, env(safe-area-inset-bottom)); width: min(100%, 800px); margin: 0 auto; flex: none; }
.composer { border: 1px solid #cdd3e5; border-radius: 18px; background: #fff; padding: 8px; box-shadow: 0 4px 16px #29386c0c; }
.composer:focus-within { border-color: #8f84c6; }
.composer-options { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.modes { display: flex; border-radius: 10px; background: #eff1fa; padding: 2px; }
.modes button { min-height: 40px; border: 0; border-radius: 8px; color: var(--quiet); background: none; padding: 4px 11px; font-size: .84rem; white-space: nowrap; }
.modes button[aria-pressed="true"] { background: var(--tint); color: #382c79; font-weight: 730; }
.select-wrap select { max-width: min(59vw, 230px); min-height: 44px; border: 0; border-radius: 8px; background: #fff; color: var(--ink); padding: 4px 6px; font-size: .84rem; }
.prompt-row { display: flex; align-items: flex-end; gap: 4px; }
textarea { flex: 1; border: 0; outline: none !important; min-width: 0; min-height: 45px; max-height: 130px; field-sizing: content; padding: 10px 6px 8px; resize: none; color: var(--ink); background: transparent; }
textarea::placeholder { color: #68728f; }
.send { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-size: 1.38rem; line-height: 1; }
.send:hover { background: #433390; }
.stop span { width: 11px; height: 11px; border-radius: 2px; background: white; }
.notice { min-height: 20px; color: var(--quiet); font-size: .75rem; text-align: center; margin: 4px 0 0; }
.notice.error { color: #9c2335; }
.shade { display: none; }
@media (max-width: 720px) {
  .room { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 2; inset: 0 auto 0 0; width: min(83vw, 310px); visibility: hidden; transform: translateX(-100%); transition: transform .18s, visibility .18s; }
  .room.history-open .sidebar { visibility: visible; transform: none; }
  .shade { display: block; position: fixed; z-index: 1; inset: 0; background: #121a3c65; }
  .topbar { min-height: 53px; padding: 0 8px; gap: 6px; }
  .menu-btn, .mobile-new { display: grid; }
  .top-title { text-align: center; }
  .demo-banner { padding-inline: 13px; }
  .welcome { padding: 24px 14px; }
  .messages { padding-inline: 13px; }
  .composer-area { padding-inline: 10px; }
  .composer-options { gap: 3px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
