@import url("./math.css");
:root {
  color-scheme: dark;
  --bg: #101014;
  --side: #151519;
  --surface: #1c1c22;
  --raised: #26262e;
  --line: #303038;
  --faint: #222229;
  --text: #efedf5;
  --sub: #b6b4c0;
  --muted: #96939f;
  --accent: #bda5f0;
  --tint: #292431;
  --strong: #d0b7ff;
  --bubble: #25242d;
  --font: 16px;
  --leading: 1.57;
  --code: 13px;
  --vh: 100dvh;
  --sidebar: 252px;
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
:root.light {
  color-scheme: light;
  --bg: #fbfafc;
  --side: #f3f1f5;
  --surface: #fff;
  --raised: #eeeaf2;
  --line: #d7d2dc;
  --faint: #e7e2eb;
  --text: #24212b;
  --sub: #524d5c;
  --muted: #696474;
  --accent: #714ba4;
  --tint: #ede6f4;
  --strong: #61438a;
  --bubble: #eeeaf4;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  background: none;
  border: 0;
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.5;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:hover {
  background-color: var(--raised);
}
button {
  touch-action: manipulation;
}
svg {
  flex-shrink: 0;
}
.ico {
  vertical-align: middle;
  pointer-events: none;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--muted);
  padding: 0;
}
.brandmark {
  width: 37px;
  height: 37px;
  color: var(--accent);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 26px;
  font-weight: 620;
  letter-spacing: -1.5px;
}
.brand span {
  transform: translateY(-1px);
}
.shell {
  display: flex;
  height: var(--vh);
  overflow: hidden;
}
.sidebar {
  display: flex;
  flex-direction: column;
  width: var(--sidebar);
  flex-shrink: 0;
  background: var(--side);
  border-right: 1px solid var(--faint);
  padding: 22px 15px 12px;
}
.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 0 7px;
}
.side-top .icon-btn {
  width: 30px;
}
.side-actions {
  padding: 32px 0 9px;
  display: grid;
  gap: 5px;
}
.newchat,
.side-search,
.side-settings {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border-radius: 9px;
  min-height: 42px;
  padding: 0 13px;
  font-size: 14px;
  font-weight: 520;
}
.newchat {
  background: var(--tint);
  border: 1px solid color-mix(in srgb, var(--accent) 19%, var(--tint));
  color: var(--strong);
}
.newchat:hover {
  background: var(--raised);
}
.side-search,
.side-settings {
  color: var(--sub);
}
.keyhint {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 4px;
  line-height: 17px;
}
.history-list {
  overflow: auto;
  flex: 1;
  min-height: 0;
  padding: 5px 0 20px;
}
.group-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  margin: 24px 13px 8px;
}
.chat-link {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 39px;
  text-align: left;
  padding: 8px 12px;
  color: var(--sub);
  border-radius: 8px;
  font-size: 14px;
}
.chat-link span,
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-link svg {
  color: var(--muted);
  width: 15px;
}
.chat-link.current {
  background: var(--raised);
  color: var(--text);
}
.chat-link.current svg {
  color: var(--accent);
}
.side-foot {
  display: grid;
  gap: 10px;
}
.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 17px 5px 2px;
}
.avatar {
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--tint);
  color: var(--strong);
  font-size: 15px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
}
.profile b,
.profile small {
  display: block;
}
.profile b {
  font-size: 14px;
  font-weight: 550;
}
.profile small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}
.topbar {
  padding: 0 24px;
  min-height: 66px;
  display: grid;
  align-items: center;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  border-bottom: 1px solid var(--faint);
}
.crumb,
.topend {
  display: flex;
  align-items: center;
  gap: 10px;
}
.crumb {
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
}
.crumb b {
  font-weight: 500;
  color: var(--sub);
}
.topend {
  justify-content: flex-end;
  gap: 8px;
}
.model-picker,
.cost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 20px;
  min-height: 35px;
}
.model-picker {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0 13px;
  font-size: 14px;
  font-weight: 550;
  max-width: 65vw;
}
.model-picker .ico {
  color: var(--muted);
}
.model-mark {
  font-family: Georgia, serif;
  font-size: 22px;
  line-height: 1;
  display: inline-block;
}
.warm {
  color: #dd9a80;
}
.cool {
  color: #b7a0e3;
}
.cost {
  border: 1px solid var(--line);
  color: var(--sub);
  padding: 0 11px;
  font:
    12px ui-monospace,
    monospace;
  white-space: nowrap;
}
.cost svg {
  color: var(--muted);
}
.nav-open {
  display: none;
}
.collapsed .sidebar {
  display: none;
}
.collapsed .nav-open {
  display: inline-grid;
}
.conversation {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  overflow-anchor: none;
}
.reading,
.compose-inner {
  width: min(100% - 64px, 750px);
  margin: auto;
}
.reading {
  padding: 32px 0 14px;
}
.chat-heading {
  font-size: 12px;
  text-align: center;
  color: var(--muted);
  margin: 0 0 23px;
  font-weight: 450;
}
.user-row {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 25px;
}
.user-bubble {
  max-width: min(86%, 560px);
  padding: 11px 16px;
  background: var(--bubble);
  border-radius: 16px 16px 5px 16px;
  font-size: var(--font);
  line-height: var(--leading);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.answer {
  margin-bottom: 28px;
}
.author {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}
.author .model-mark {
  font-size: 19px;
}
.reason {
  font-size: 13px;
  color: var(--muted);
  margin: 9px 0 12px;
}
.reason summary,
.error-detail summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  min-height: 25px;
}
.reason summary::-webkit-details-marker,
.error-detail summary::-webkit-details-marker {
  display: none;
}
.reason summary .ico:last-child {
  width: 12px;
}
.reason[open] summary .ico:last-child {
  transform: rotate(90deg);
}
.reason p {
  padding-left: 11px;
  border-left: 2px solid var(--line);
  white-space: pre-wrap;
  font-size: 14px;
}
.markdown,
.streaming {
  font-size: var(--font);
  line-height: var(--leading);
  overflow-wrap: anywhere;
}
.markdown > :first-child {
  margin-top: 10px;
}
.markdown p {
  margin: 12px 0;
}
.markdown strong {
  font-weight: 630;
}
.markdown h1,
.markdown h2,
.markdown h3 {
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 1.1em 0 0.35em;
}
.markdown ul,
.markdown ol {
  padding-left: 1.45em;
}
.markdown blockquote {
  margin: 1em 0;
  border-left: 2px solid var(--accent);
  padding-left: 12px;
  color: var(--sub);
}
.markdown a {
  color: var(--accent);
}
.markdown :not(pre) > code {
  background: var(--surface);
  font-size: 0.86em;
  padding: 1px 4px;
  border-radius: 4px;
}
.table-wrap,
.mathBlock {
  overflow: auto;
  display: block;
}
.markdown table {
  border-collapse: collapse;
  width: max-content;
  min-width: 60%;
}
.markdown th,
.markdown td {
  border-bottom: 1px solid var(--line);
  padding: 6px 12px;
  text-align: left;
}
.streaming {
  white-space: pre-wrap;
  margin: 12px 0;
}
.study {
  margin: 15px 0 14px;
  border: 1px solid #36303f;
  background-color: #15131b;
  color: #d2cbdc;
  border-radius: 13px;
  overflow: hidden;
  background-image: radial-gradient(#43394e 0.65px, transparent 0.8px);
  background-size: 14px 14px;
}
.study figcaption,
.study-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  font-size: 12px;
}
.study figcaption span,
.study-foot span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.study figcaption span {
  color: #c7bdd3;
  background: #15131b;
  padding-right: 5px;
}
.study figcaption button {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  background: #211e28;
  color: #cdc4da;
  border: 1px solid #3b3545;
  border-radius: 50%;
}
.study canvas {
  display: block;
  width: 100%;
  height: clamp(105px, 14vh, 154px);
}
.study-foot {
  justify-content: center;
  gap: 18px;
  color: #b3a8c3;
  font:
    11px ui-monospace,
    monospace;
  padding: 8px 12px 12px;
}
.study-foot i {
  width: 10px;
  height: 2px;
  background: #ab92e6;
}
.study-foot span + span i {
  background: #c295c7;
}
.codebox {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin: 14px 0;
}
.codebar,
.codebar > span,
.codebar > div,
.action-line {
  display: flex;
  align-items: center;
}
.codebar {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 2px 8px 2px 12px;
  color: var(--muted);
  font-size: 12px;
}
.codebar > span {
  gap: 8px;
}
.codebar .icon-btn {
  width: 33px;
  height: 33px;
}
.codebar .ico {
  width: 15px;
}
.codebox pre,
.code-full {
  margin: 0;
  max-height: 270px;
  overflow: auto;
  padding: 13px 15px;
  line-height: 1.55;
  tab-size: 2;
  font-size: var(--code);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre;
}
.wrap-code pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-literal {
  color: #c3a4e6;
}
.hljs-title,
.hljs-function .hljs-title {
  color: #a9bce8;
}
.hljs-number,
.hljs-attr {
  color: #e2bc99;
}
.hljs-string,
.hljs-built_in {
  color: #9ccbbb;
}
.hljs-comment {
  color: var(--muted);
}
.light .hljs-keyword,
.light .hljs-literal {
  color: #755099;
}
.light .hljs-title {
  color: #3b508b;
}
.light .hljs-number,
.light .hljs-attr {
  color: #8b5425;
}
.light .hljs-string,
.light .hljs-built_in {
  color: #376f59;
}
.action-line {
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
  min-height: 32px;
}
.action-line .icon-btn {
  width: 31px;
  height: 31px;
}
.action-line .ico {
  width: 15px;
}
.meta-btn {
  font-size: 12px;
  color: var(--muted);
  padding: 7px;
  border-radius: 6px;
}
.error-detail {
  color: var(--muted);
  font-size: 13px;
}
.text-action {
  color: var(--accent);
  border-radius: 6px;
  padding: 7px;
}
.composer {
  padding: 9px 0 max(18px, env(safe-area-inset-bottom));
  background: var(--bg);
}
.compose-inner {
  position: relative;
}
.compose-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 55px;
  padding: 7px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 19px;
  box-shadow: 0 6px 24px #00000012;
}
.compose-box:focus-within {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
}
.compose-box textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  background: none;
  border: 0;
  outline: none;
  padding: 8px 0;
  max-height: min(26vh, 150px);
  font-size: 16px;
  line-height: 24px;
  height: 40px;
}
.compose-box textarea:focus-visible {
  outline: none;
}
.send-btn {
  background: var(--strong);
  color: #261d30;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
}
.send-btn:hover {
  background: var(--accent);
}
.send-btn:disabled {
  opacity: 0.72;
}
.compose-box .icon-btn {
  height: 39px;
}
.compose-note {
  margin: 8px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 11px;
}
.file-chip {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--sub);
}
.file-chip button {
  color: var(--accent);
}
.empty,
.login,
.loading {
  display: grid;
  min-height: 56vh;
  align-content: center;
  justify-items: center;
  gap: 12px;
  text-align: center;
}
.empty h1,
.login h1 {
  font-weight: 550;
  letter-spacing: -0.05em;
  margin: 3px 0;
  font-size: 32px;
}
.empty p,
.login p {
  color: var(--muted);
  margin: 0;
}
.login {
  min-height: var(--vh);
  padding: 24px;
}
.login form {
  width: min(100%, 325px);
  display: grid;
  gap: 12px;
  text-align: left;
  margin-top: 12px;
}
.primary {
  border-radius: 10px;
  background: var(--strong);
  color: #201927;
  font-weight: 600;
  padding: 11px 14px;
}
.primary:hover {
  background: var(--accent);
}
.input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 11px 12px;
  font-size: 16px;
  width: 100%;
}
.veil {
  display: none;
}
dialog {
  background: var(--side);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 18px;
  width: min(460px, calc(100% - 28px));
  padding: 18px;
  max-height: 80dvh;
  box-shadow: 0 15px 65px #0005;
}
dialog::backdrop {
  background: #08070c91;
  backdrop-filter: blur(3px);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.dialog-head h2 {
  font-size: 19px;
  letter-spacing: -0.04em;
  margin: 0;
}
.dialog-head .icon-btn {
  width: 32px;
  height: 32px;
}
.dialog-body > p,
.hint {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}
.dialog-body h3 {
  font-size: 13px;
  color: var(--muted);
  font-weight: 550;
}
.model-list {
  margin-top: 12px;
  max-height: 48dvh;
  overflow: auto;
}
.model-row {
  display: flex;
  align-items: center;
  border-radius: 10px;
}
.model-row.selected {
  background: var(--tint);
}
.model-choice {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  text-align: left;
  gap: 12px;
  padding: 10px;
  border-radius: 8px;
}
.model-choice b,
.model-choice small {
  display: block;
  overflow-wrap: anywhere;
}
.model-choice b {
  font-size: 14px;
  font-weight: 550;
}
.model-choice small,
.model-details {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}
.fav-on {
  color: var(--accent);
}
.model-filters,
.toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.model-filters {
  margin: 12px 0 5px;
}
.chip,
.toolbar button {
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  padding: 7px 11px;
  color: var(--sub);
}
.chip.on {
  color: var(--accent);
  background: var(--tint);
}
.setting {
  display: grid;
  gap: 9px;
  margin: 20px 0;
  color: var(--sub);
  font-size: 14px;
}
.setting span,
.usage-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.setting output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.setting input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}
.setting-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 0;
  font-size: 14px;
}
.setting-toggle input {
  accent-color: var(--accent);
  width: 19px;
  height: 19px;
}
.usage-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--faint);
  font-size: 14px;
  color: var(--sub);
}
.usage-row b {
  font-weight: 550;
  color: var(--text);
}
.code-dialog {
  width: min(920px, 95vw);
}
.code-dialog pre {
  max-height: 55dvh;
  background: var(--surface);
  margin-top: 12px;
  border-radius: 10px;
}
.status-line {
  color: var(--muted);
  font-size: 13px;
}
.offline-note {
  color: var(--accent);
  text-align: center;
  font-size: 12px;
}
.error {
  color: #e8ac9c;
  font-size: 14px;
}
#toast {
  position: fixed;
  z-index: 20;
  inset: auto 0 92px;
  margin: auto;
  width: max-content;
  max-width: 90vw;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--raised);
  color: var(--text);
  box-shadow: 0 3px 18px #0003;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
#toast.show {
  opacity: 1;
}
.jump {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 50%;
}
[hidden] {
  display: none !important;
}
@media (min-width: 1200px) {
  :root {
    --sidebar: 266px;
  }
  .sidebar {
    padding-left: 20px;
    padding-right: 20px;
  }
  .reading,
  .compose-inner {
    width: min(100% - 90px, 760px);
  }
}
@media (max-width: 850px) {
  .conversation {
    scrollbar-width: none;
  }
  .conversation::-webkit-scrollbar {
    display: none;
  }
  .sidebar,
  .collapsed .sidebar {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 5;
    height: var(--vh);
    width: min(300px, 84vw);
    transform: translateX(-101%);
    visibility: hidden;
    transition:
      transform 0.18s,
      visibility 0.18s;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .drawer .sidebar {
    visibility: visible;
    transform: none;
  }
  .drawer .veil {
    position: fixed;
    inset: 0;
    background: #0009;
    display: block;
    z-index: 4;
  }
  .nav-open {
    display: inline-grid;
  }
  .crumb .trail {
    display: none;
  }
  .topbar {
    min-height: 55px;
    padding: env(safe-area-inset-top) 10px 0;
    border: 0;
  }
  .topend {
    gap: 2px;
  }
  .topend .settings-top {
    display: none;
  }
  .reading,
  .compose-inner {
    width: calc(100% - 32px);
    max-width: 720px;
  }
  .reading {
    padding-top: 12px;
  }
  .chat-heading {
    margin-bottom: 18px;
  }
  .composer {
    padding: 6px 0 max(10px, env(safe-area-inset-bottom));
  }
  .compose-inner {
    width: calc(100% - 20px);
  }
  .compose-note {
    display: none;
  }
  .model-picker {
    max-width: 55vw;
  }
  .reason {
    margin: 7px 0 9px;
  }
  .user-row {
    margin-bottom: 20px;
  }
  .user-bubble {
    max-width: 90%;
    padding: 9px 13px;
  }
  .topbar .cost {
    font-size: 11px;
    gap: 5px;
    padding: 0 8px;
    min-height: 32px;
  }
  .topbar .cost .ico {
    width: 14px;
  }
  .study canvas {
    height: 112px;
  }
  .study figcaption {
    padding-top: 7px;
    padding-bottom: 1px;
  }
  .keyhint {
    display: none;
  }
  .codebar .icon-btn,
  .action-line .icon-btn {
    min-height: 35px;
  }
  .model-list {
    max-height: 48dvh;
  }
  .topbar .nav-open {
    background: var(--surface);
    border-radius: 50%;
    width: 36px;
    height: 36px;
  }
  .reading .answer:last-child {
    margin-bottom: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
