:root {
  color-scheme: light;
  --paper: #f3f6f7;
  --white: #ffffff;
  --ink: #1e3345;
  --muted: #5d707d;
  --teal: #2f7777;
  --line: #dce5e9;
  --teal-wash: #e8f2f1;
  --red: #a43d38;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", "STSong", "SimSun", serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { color: var(--ink); background: var(--white); font-family: var(--sans); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button, input, textarea, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 3px solid #79adad; outline-offset: 3px; }
button { transition: background-color 140ms ease, border-color 140ms ease; }
::selection { background: #cfe6e4; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.boot { height: 100dvh; display: grid; place-content: center; color: var(--muted); }
.loading-dots { letter-spacing: 4px; }
.brand-mark { width: 49px; height: 49px; border: 1px solid var(--teal); color: var(--teal); font-family: var(--serif); font-size: 29px; display: grid; place-items: center; border-radius: 13px 13px 13px 3px; }
.brand-mark.small { flex: 0 0 auto; width: 35px; height: 35px; font-size: 22px; border-radius: 10px 10px 10px 2px; }
.login-screen { min-height: 100dvh; display: grid; place-items: center; background: var(--paper); padding: 30px 20px; }
.login-card { width: min(100%, 410px); padding: 45px 40px 29px; background: var(--white); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 50px #1e334507; }
.eyebrow { margin: 28px 0 10px; font-size: 10px; font-weight: 600; letter-spacing: 2px; color: var(--teal); }
.login-card h1 { margin: 0; font: 500 31px/1.4 var(--serif); letter-spacing: 1px; }
.login-intro { margin: 15px 0 30px; font-size: 14px; line-height: 1.9; color: var(--muted); }
.login-card label { display: block; margin: 0 0 9px; font-size: 12px; font-weight: 600; }
.login-card input { display: block; width: 100%; min-height: 46px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: var(--paper); outline: none; }
.login-card input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-wash); }
.primary-button { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding: 13px 16px; border: 1px solid var(--teal); border-radius: 7px; color: var(--white); background: var(--teal); }
.primary-button:hover:not(:disabled) { background: #286767; }
.primary-button:disabled { opacity: .65; }
.form-error { font-size: 12px; line-height: 1.6; color: var(--red); }
.login-footnote { margin: 27px 0 0; color: var(--muted); font-size: 11px; text-align: center; letter-spacing: 2px; }
.app { display: flex; width: 100%; height: 100dvh; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; flex: 0 0 258px; width: 258px; background: var(--paper); border-right: 1px solid var(--line); padding: 27px 17px 0; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-name { display: block; font-size: 17px; font-family: var(--serif); letter-spacing: .6px; }
.brand-caption { display: block; margin-top: 4px; font-size: 10px; color: var(--muted); letter-spacing: .5px; }
.new-chat { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 30px 5px 29px; min-height: 43px; background: var(--white); border: 1px solid #cbd9dd; border-radius: 7px; font-size: 13px; }
.new-chat > span { font-size: 20px; line-height: 1; color: var(--teal); }
.new-chat:hover { background: var(--teal-wash); border-color: #aacbca; }
.history-label { padding: 0 13px 12px; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; letter-spacing: 1px; }
#conversation-count { font-size: 10px; font-variant-numeric: tabular-nums; }
.conversation-list { min-height: 0; overflow: auto; scrollbar-width: thin; padding: 1px 0 20px; }
.conversation-item { position: relative; display: flex; align-items: center; margin: 2px 0; border-radius: 7px; }
.conversation-item:hover { background: #e9eef0; }
.conversation-item.active { background: #e2ecec; }
.conversation-link { min-width: 0; width: 100%; padding: 11px 35px 11px 13px; border: 0; text-align: left; background: none; }
.conversation-title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.5; font-size: 12px; }
.conversation-date { display: block; margin-top: 5px; font-size: 10px; color: var(--muted); }
.conversation-delete { position: absolute; right: 5px; width: 27px; height: 27px; padding: 5px; opacity: 0; border: none; background: none; color: var(--muted); border-radius: 4px; }
.conversation-item:hover .conversation-delete, .conversation-item:focus-within .conversation-delete { opacity: 1; }
.conversation-delete:hover { color: var(--red); background: #ffffff99; }
.history-empty { color: var(--muted); margin: 10px 13px; font-size: 12px; line-height: 1.9; }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding: 19px 8px 21px; border-top: 1px solid var(--line); }
.session-label { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--muted); }
.status-dot { display: inline-block; width: 5px; height: 5px; background: var(--teal); border-radius: 50%; }
.text-button { border: 0; padding: 4px; background: none; font-size: 11px; color: var(--muted); }
.text-button:hover { color: var(--ink); }
.workspace { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.topbar { min-height: 73px; flex: 0 0 73px; padding: 0 35px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #edf1f3; }
.topbar-title { font-size: 13px; font-weight: 600; }
.topbar-divider { display: inline-block; margin: 0 8px; color: #9caeb7; }
.model-name { font-size: 11px; font-weight: 400; color: var(--muted); }
.mode-label { font-size: 11px; color: var(--muted); }
.mode-label > span { color: var(--teal); font-size: 15px; margin-right: 4px; }
.scroll-area { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #cbd6db transparent; }
.welcome { width: min(100% - 80px, 754px); margin: 0 auto; padding: clamp(55px, 11vh, 124px) 0 35px; }
.welcome-note { display: flex; gap: 10px; align-items: center; font-size: 11px; letter-spacing: 1px; color: var(--teal); }
.note-line { width: 23px; height: 1px; background: var(--teal); }
.welcome h1 { margin: 24px 0 17px; font: 500 clamp(27px, 3.2vw, 36px)/1.4 var(--serif); letter-spacing: 1px; }
.title-period { color: var(--teal); }
.welcome-description { margin: 0; font-size: 13px; line-height: 2; color: var(--muted); }
.starters { margin-top: 35px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.starter { min-width: 0; padding: 18px 16px; min-height: 106px; background: var(--white); border: 1px solid var(--line); border-radius: 8px; text-align: left; }
.starter:hover { border-color: #9dbfbf; background: #f7faf9; }
.starter-label { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 12px; font-size: 13px; font-weight: 500; }
.starter-label > span { color: var(--teal); font-size: 15px; }
.starter-description { display: block; color: var(--muted); font-size: 11px; line-height: 1.8; }
.welcome-aside { margin: 23px 0 0; font-size: 11px; line-height: 1.8; color: var(--muted); }
.messages { width: min(100% - 80px, 754px); margin: 0 auto; padding: 26px 0 28px; }
.messages:empty { display: none; }
.message { margin: 16px 0 32px; }
.message-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; font-size: 11px; color: var(--muted); }
.message-avatar { display: grid; place-items: center; width: 22px; height: 22px; background: var(--teal-wash); border-radius: 6px 6px 6px 1px; color: var(--teal); font: 15px var(--serif); }
.message-content { overflow-wrap: anywhere; font-size: 14px; line-height: 1.95; }
.message.user { display: flex; flex-direction: column; align-items: flex-end; margin-top: 23px; margin-bottom: 28px; }
.message.user .message-content { max-width: min(88%, 630px); white-space: pre-wrap; padding: 13px 19px; border-radius: 12px 12px 2px 12px; background: #edf2f4; }
.message.user .message-heading { margin-bottom: 7px; margin-right: 3px; }
.message-content p { margin: 0 0 14px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content h2, .message-content h3, .message-content h4 { margin: 23px 0 10px; font-size: 16px; font-weight: 600; line-height: 1.7; }
.message-content h2 { font-size: 18px; }
.message-content :first-child { margin-top: 0; }
.message-content ul, .message-content ol { margin: 10px 0 15px; padding-left: 23px; }
.message-content li { padding-left: 3px; margin: 5px 0; }
.message-content blockquote { margin: 15px 0; padding: 2px 0 2px 16px; border-left: 2px solid #abc8c7; color: var(--muted); }
.message-content a { color: var(--teal); text-decoration-color: #91b9b8; text-underline-offset: 3px; }
.message-content code { font-family: "Cascadia Code", Consolas, monospace; font-size: .88em; background: var(--paper); padding: 2px 5px; border-radius: 4px; }
.message-content pre { max-width: 100%; overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 7px; padding: 15px 17px; line-height: 1.7; }
.message-content pre code { padding: 0; background: none; }
.table-scroll { overflow: auto; margin: 16px 0; }
.message-content table { width: 100%; border-collapse: collapse; font-size: 12px; }
.message-content th, .message-content td { padding: 8px 11px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.message-content th { background: var(--paper); font-weight: 600; }
.message-footer { display: flex; gap: 12px; align-items: center; margin-top: 12px; min-height: 17px; color: var(--muted); font-size: 11px; }
.message-footer:empty { display: none; }
.retry-button { border: 0; padding: 3px 0; background: transparent; color: var(--teal); font-size: 11px; }
.retry-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.thinking { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; min-height: 30px; }
.thinking-dot { height: 6px; width: 6px; border-radius: 50%; background: var(--teal); animation: breathe 1.5s ease-in-out infinite; }
.composer-area { flex: 0 0 auto; width: min(100% - 80px, 780px); margin: 0 auto; padding: 0 0 18px; }
.composer { border: 1px solid #cedcdf; border-radius: 13px; background: var(--white); padding: 15px 15px 10px 18px; box-shadow: 0 4px 20px #1e334506; transition: border-color 150ms ease; }
.composer:focus-within { border-color: #7ba5a5; box-shadow: 0 0 0 2px #e8f2f180; }
.composer textarea { display: block; width: 100%; max-height: 180px; min-height: 30px; resize: none; border: 0; outline: 0; padding: 0; background: transparent; color: var(--ink); font-size: 13px; line-height: 1.8; scrollbar-width: thin; }
.composer textarea::placeholder { color: #7a8d98; }
.composer-bottom { min-height: 37px; display: flex; align-items: flex-end; gap: 10px; padding-top: 8px; }
.composer-status { align-self: center; flex: 1; font-size: 10px; color: var(--muted); }
.send-button { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; border: 0; border-radius: 8px; background: var(--teal); color: var(--white); }
.send-button:hover:not(:disabled) { background: #286767; }
.send-button:disabled { color: #8ea1ab; background: #edf2f4; }
.cancel-button { border: 1px solid var(--line); background: var(--white); border-radius: 6px; padding: 7px 10px; font-size: 11px; }
.cancel-button:hover { background: var(--paper); }
.cancel-button > span { font-size: 8px; margin-right: 4px; }
.composer-hint { margin: 11px 0 0; font-size: 10px; line-height: 1.6; color: var(--muted); text-align: center; }
.hint-separator { margin: 0 9px; }
.notice { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 11px; padding: 9px 11px 9px 14px; color: var(--red); background: #fbf3f2; border: 1px solid #edd7d5; border-radius: 7px; font-size: 12px; line-height: 1.7; }
.icon-button { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; padding: 0; border: none; border-radius: 5px; color: var(--muted); background: transparent; font-size: 24px; line-height: 1; }
.icon-button:hover { background: #1e334508; }
.mobile-only { display: none; }
@keyframes breathe { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
@media (min-width: 1500px) { .sidebar { width: 278px; flex-basis: 278px; } }
@media (max-width: 1050px) {
  .sidebar { width: 232px; flex-basis: 232px; padding-left: 12px; padding-right: 12px; }
  .welcome, .messages { width: calc(100% - 54px); }
  .composer-area { width: calc(100% - 48px); }
  .starter { padding: 15px 12px; }
  .starter-description { font-size: 10px; }
}
@media (max-width: 760px) {
  .mobile-only { display: grid; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; width: 278px; padding: 24px 17px 0; transform: translateX(-100%); transition: transform 180ms ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-brand { padding-right: 0; }
  #close-sidebar { margin-left: auto; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 19; border: 0; background: #142b4155; }
  .conversation-delete { opacity: 1; }
  .topbar { flex-basis: 61px; min-height: 61px; padding: 0 16px; gap: 10px; }
  .topbar-title { margin-right: auto; font-size: 12px; }
  .topbar-divider { margin: 0 5px; }
  .mode-label { display: none; }
  .welcome { width: calc(100% - 44px); padding-top: clamp(33px, 9vh, 75px); padding-bottom: 28px; }
  .welcome h1 { margin-top: 22px; font-size: 28px; letter-spacing: .2px; }
  .welcome-description { font-size: 12px; line-height: 1.9; }
  .starters { grid-template-columns: 1fr; gap: 9px; margin-top: 25px; }
  .starter { min-height: 0; padding: 14px 15px; }
  .starter-label { margin-bottom: 4px; font-size: 12px; }
  .starter-description { font-size: 11px; }
  .welcome-aside { margin-top: 18px; font-size: 10px; }
  .messages { width: calc(100% - 38px); padding-top: 13px; padding-bottom: 15px; }
  .message-content { font-size: 14px; line-height: 1.9; }
  .message.user .message-content { max-width: 92%; padding: 10px 15px; }
  .composer-area { width: calc(100% - 26px); padding-bottom: max(11px, env(safe-area-inset-bottom)); }
  .composer { border-radius: 11px; padding: 12px 11px 8px 14px; }
  .composer textarea { font-size: 16px; line-height: 1.65; }
  .composer textarea::placeholder { font-size: 12px; }
  .composer-hint { font-size: 9px; margin-top: 8px; }
  .desktop-break { display: none; }
}
@media (max-width: 380px) {
  .welcome h1 { font-size: 25px; }
  .welcome { width: calc(100% - 36px); }
  .login-card { padding: 33px 25px 25px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
