@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/assets/fonts/geist-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/assets/fonts/geist-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/assets/fonts/geist-mono-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(/assets/fonts/geist-mono-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root,
html[data-theme='graphite'] {
  --bg: #17181b;
  --side: #131416;
  --raise: #1e1f23;
  --hover: #272830;
  --line: #2b2d33;
  --line-2: #3a3d46;
  --fg: #e8e9ec;
  --dim: #a4a7b0;
  --faint: #83868f;
  --accent: #dfa55a;
  --accent-fg: #1a1306;
  --danger: #f0766b;
  --code: #121316;
  --sel: rgba(223, 165, 90, 0.28);
  --theme-color: #17181b;
}
html[data-theme='ink'] {
  --bg: #08080a;
  --side: #050506;
  --raise: #121215;
  --hover: #1b1b20;
  --line: #1f1f25;
  --line-2: #30303a;
  --fg: #ececee;
  --dim: #a0a0aa;
  --faint: #7d7d87;
  --accent: #6fd3b8;
  --accent-fg: #04201a;
  --danger: #f27d72;
  --code: #0d0d10;
  --sel: rgba(111, 211, 184, 0.26);
  --theme-color: #08080a;
}
html[data-theme='dusk'] {
  --bg: #141720;
  --side: #10131a;
  --raise: #1b1f2b;
  --hover: #242938;
  --line: #262b3a;
  --line-2: #363d51;
  --fg: #e6e9f2;
  --dim: #a0a7bb;
  --faint: #7e869c;
  --accent: #8fa8ff;
  --accent-fg: #0d1430;
  --danger: #f0786f;
  --code: #0f1219;
  --sel: rgba(143, 168, 255, 0.28);
  --theme-color: #141720;
}
html[data-theme='ember'] {
  --bg: #1a1613;
  --side: #15110f;
  --raise: #231d19;
  --hover: #2d2520;
  --line: #31281f;
  --line-2: #433830;
  --fg: #efe9e3;
  --dim: #b3a79c;
  --faint: #92867b;
  --accent: #e07a55;
  --accent-fg: #2a0e04;
  --danger: #f2796c;
  --code: #14100e;
  --sel: rgba(224, 122, 85, 0.28);
  --theme-color: #1a1613;
}

:root {
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --side-w: 288px;
  --fs: 15.5px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-kw: #e6a27c;
  --t-str: #a5c98a;
  --t-num: #e5c07b;
  --t-com: #7d8290;
  --t-fn: #7fb4e8;
  --t-attr: #c7b0ee;
  --t-type: #7cc7c0;
  --t-tag: #e8838f;
  --t-meta: #8e95a3;
  color-scheme: dark;
}
html[data-size='sm'] {
  --fs: 14.5px;
}
html[data-size='lg'] {
  --fs: 17px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
[hidden] {
  display: none !important;
}
html,
body {
  height: 100%;
}
body {
  background: var(--bg);
  color: var(--fg);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  background: none;
  border: 0;
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
}
a {
  color: inherit;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
::selection {
  background: var(--sel);
}
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.ic {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
kbd {
  font: 500 11px/1 var(--mono);
  color: var(--faint);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 3px 5px;
}

.btn {
  height: 36px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--raise);
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover {
  background: var(--hover);
}
.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-fg);
}
.btn.primary:hover {
  filter: brightness(1.08);
}
.btn.primary:disabled {
  background: var(--hover);
  color: var(--faint);
  filter: none;
}
.btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}
.btn.danger:hover {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  color: var(--dim);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover {
  background: var(--hover);
  color: var(--fg);
}

.logo {
  width: 22px;
  height: 22px;
  flex: none;
}
.logo rect {
  fill: none;
  stroke: var(--fg);
  stroke-width: 1.8;
}
.logo path {
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
}

.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  height: 100dvh;
  transition: grid-template-columns 0.24s var(--ease);
}
.app.collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}
.app.collapsed .side {
  visibility: hidden;
}
.scrim {
  display: none;
}

.side {
  background: var(--side);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: var(--side-w);
  overflow: hidden;
}
.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 8px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.side-actions {
  padding: 4px 12px 8px;
  display: grid;
  gap: 8px;
}
.new-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--raise);
  font-weight: 500;
  transition: background 0.15s;
}
.new-btn:hover {
  background: var(--hover);
}
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--faint);
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--raise) 70%, transparent);
}
.search:focus-within {
  border-color: var(--line-2);
  color: var(--dim);
}
.search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  color: var(--fg);
  font-size: 13.5px;
}
.search input::placeholder {
  color: var(--faint);
}
.list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 8px 12px;
}
.group {
  padding: 14px 10px 6px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}
.item {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: 9px;
}
.item:hover,
.item.menu-open {
  background: var(--hover);
}
.item.active {
  background: var(--hover);
}
.item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.item-main {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  text-decoration: none;
  display: block;
}
.item-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  color: var(--dim);
}
.item.active .item-title,
.item:hover .item-title {
  color: var(--fg);
}
.item-snip {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--faint);
  margin-top: 1px;
}
.item-pin {
  color: var(--faint);
  width: 14px;
  height: 14px;
  margin-left: 8px;
}
.item-more {
  width: 28px;
  height: 28px;
  margin-right: 4px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--dim);
  opacity: 0;
}
.item:hover .item-more,
.item.menu-open .item-more,
.item-more:focus-visible {
  opacity: 1;
}
.item-more:hover {
  background: var(--line);
  color: var(--fg);
}
.item-edit {
  flex: 1;
  margin: 4px 6px;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--accent);
  background: var(--bg);
  outline: 0;
  font-size: 13.5px;
}
.empty-list {
  padding: 24px 14px;
  color: var(--faint);
  font-size: 13px;
}
.side-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--raise);
  border: 1px solid var(--line-2);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
}
.who-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 500;
}

.main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.top {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 52px;
  padding: 0 10px;
  flex: none;
}
.top .open-side {
  display: none;
}
.app.collapsed .top .open-side {
  display: inline-grid;
}
.chat-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 6px;
}
.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.thread {
  max-width: 780px;
  margin: 0 auto;
  padding: 12px 20px 36px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.to-bottom {
  position: absolute;
  right: 50%;
  transform: translateX(50%);
  bottom: 138px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--raise);
  border: 1px solid var(--line-2);
  color: var(--dim);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.to-bottom:hover {
  color: var(--fg);
  background: var(--hover);
}

.empty {
  margin: 12vh auto 0;
  max-width: 560px;
  width: 100%;
  display: grid;
  gap: 28px;
}
.empty h2 {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.empty p {
  color: var(--dim);
  margin-top: 8px;
  font-size: 15px;
}
.tips {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.tip {
  text-align: left;
  padding: 13px 16px;
  color: var(--dim);
  font-size: 14px;
  border-top: 1px solid var(--line);
  transition: background 0.15s, color 0.15s;
}
.tip:first-child {
  border-top: 0;
}
.tip:hover {
  background: var(--raise);
  color: var(--fg);
}

.msg {
  display: flex;
  flex-direction: column;
  min-width: 0;
  animation: rise 0.22s var(--ease);
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
}
.msg.me {
  align-items: flex-end;
}
.bubble {
  max-width: min(88%, 620px);
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 16px 16px 5px 16px;
  padding: 10px 14px;
  font-size: var(--fs);
  line-height: 1.6;
}
.bubble .txt {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.shots-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.shots-row:last-child {
  margin-bottom: 0;
}
.shot {
  display: block;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--line-2);
}
.shot img {
  display: block;
  height: 112px;
  width: auto;
  max-width: 220px;
  object-fit: cover;
}
.foot {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 6px;
  min-height: 30px;
  color: var(--faint);
  opacity: 0;
  transition: opacity 0.15s;
}
.msg:hover .foot,
.msg:focus-within .foot,
.msg.ai:last-child .foot {
  opacity: 1;
}
.msg.live .foot {
  display: none;
}
.msg.ai:not(:last-child) [data-act='regen'] {
  display: none;
}
.act {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--faint);
}
.act:hover {
  background: var(--hover);
  color: var(--fg);
}
.act .ic {
  width: 16px;
  height: 16px;
}
.meta {
  font-size: 12px;
  margin-left: 8px;
}
.edit-box {
  width: min(100%, 620px);
  display: grid;
  gap: 8px;
}
.edit-box textarea {
  width: 100%;
  min-height: 84px;
  max-height: 45dvh;
  resize: vertical;
  background: var(--raise);
  border: 1px solid var(--accent);
  border-radius: 14px;
  padding: 10px 14px;
  outline: 0;
  font-size: var(--fs);
  line-height: 1.6;
}
.edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.edit-actions .btn {
  height: 32px;
  padding: 0 14px;
  font-size: 13px;
}

.status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--faint);
  font-size: 13px;
  padding: 2px 0 8px;
}
.status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.25;
    transform: scale(0.8);
  }
}
.err {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  background: color-mix(in srgb, var(--danger) 9%, transparent);
  color: color-mix(in srgb, var(--danger) 70%, var(--fg));
  font-size: 13.5px;
}
.err .ic {
  color: var(--danger);
}
.err span {
  flex: 1;
}
.err .btn {
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
}

.prose {
  font-size: var(--fs);
  line-height: 1.72;
  overflow-wrap: anywhere;
  min-width: 0;
}
.blk {
  display: contents;
}
.prose > .blk > *:first-child,
.prose > .blk:first-child > * {
  margin-top: 0;
}
.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose .code,
.prose .tbl,
.prose hr,
.prose .math-block {
  margin: 0 0 0.9em;
}
.prose > :last-child,
.prose > .blk:last-child > * {
  margin-bottom: 0;
}
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  margin: 1.5em 0 0.55em;
}
.prose h1 {
  font-size: 1.4em;
}
.prose h2 {
  font-size: 1.22em;
}
.prose h3 {
  font-size: 1.08em;
}
.prose h4 {
  font-size: 1em;
  color: var(--dim);
}
.prose ul,
.prose ol {
  padding-left: 1.5em;
}
.prose li {
  margin: 0.28em 0;
  padding-left: 0.2em;
}
.prose li > p {
  margin: 0.3em 0;
}
.prose li::marker {
  color: var(--faint);
}
.prose strong {
  font-weight: 600;
}
.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
}
.prose a:hover {
  text-decoration-color: var(--accent);
}
.prose blockquote {
  border-left: 2px solid var(--line-2);
  padding: 0.1em 0 0.1em 1em;
  color: var(--dim);
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 1.6em 0;
}
.prose :not(pre) > code {
  font: 500 0.87em var(--mono);
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.12em 0.4em;
}
.prose input[type='checkbox'] {
  accent-color: var(--accent);
  margin-right: 0.5em;
}
.msg.live .prose > :last-child:is(p, li, h1, h2, h3, h4, blockquote)::after,
.msg.live .prose > .blk:last-child > :is(p, h1, h2, h3, h4, blockquote)::after {
  content: '';
  display: inline-block;
  width: 0.5em;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -0.17em;
  background: var(--accent);
  border-radius: 1px;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink {
  to {
    visibility: hidden;
  }
}

.code {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--code);
  overflow: hidden;
}
.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
  padding: 0 6px 0 14px;
  border-bottom: 1px solid var(--line);
  color: var(--faint);
  font: 500 12px var(--mono);
}
.code-copy {
  height: 26px;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--dim);
  font: 500 12px var(--font);
}
.code-copy:hover {
  background: var(--hover);
  color: var(--fg);
}
.code pre {
  overflow-x: auto;
  padding: 14px 16px;
  font: 400 13px/1.65 var(--mono);
  tab-size: 2;
}
.code code {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: var(--fg);
}
.tbl {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.tbl table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.93em;
}
.tbl th,
.tbl td {
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td {
  white-space: normal;
  min-width: 120px;
}
.tbl th {
  background: var(--raise);
  font-weight: 600;
  color: var(--dim);
}
.tbl tr:last-child td {
  border-bottom: 0;
}
.math-block {
  overflow-x: auto;
  padding: 4px 0;
}
.katex {
  font-size: 1.06em;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-doctag,
.hljs-literal,
.hljs-name {
  color: var(--t-kw);
}
.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-symbol {
  color: var(--t-str);
}
.hljs-number,
.hljs-bullet {
  color: var(--t-num);
}
.hljs-comment,
.hljs-quote {
  color: var(--t-com);
}
.hljs-title,
.hljs-section,
.hljs-title.function_ {
  color: var(--t-fn);
}
.hljs-attr,
.hljs-attribute,
.hljs-property,
.hljs-variable,
.hljs-template-variable {
  color: var(--t-attr);
}
.hljs-type,
.hljs-class .hljs-title,
.hljs-title.class_,
.hljs-built_in {
  color: var(--t-type);
}
.hljs-tag,
.hljs-selector-id,
.hljs-selector-class,
.hljs-deletion {
  color: var(--t-tag);
}
.hljs-meta,
.hljs-params,
.hljs-subst {
  color: var(--t-meta);
}
.hljs-emphasis {
  font-style: italic;
}
.hljs-strong {
  font-weight: 700;
}

.dock {
  flex: none;
  padding: 0 16px calc(10px + env(safe-area-inset-bottom));
}
.composer {
  max-width: 780px;
  margin: 0 auto;
  background: var(--raise);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  padding: 10px 10px 8px;
  transition: border-color 0.15s;
}
.composer:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2));
}
.composer.drop {
  border-color: var(--accent);
  border-style: dashed;
}
.composer textarea {
  display: block;
  width: 100%;
  background: none;
  border: 0;
  outline: 0;
  resize: none;
  padding: 4px 8px 6px;
  font-size: 15.5px;
  line-height: 1.55;
  max-height: 38dvh;
}
.composer textarea::placeholder {
  color: var(--faint);
}
.shots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 6px 8px;
}
.pick {
  position: relative;
}
.pick img {
  display: block;
  height: 58px;
  width: 58px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line-2);
}
.pick button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--dim);
}
.pick button .ic {
  width: 12px;
  height: 12px;
}
.bar {
  display: flex;
  align-items: center;
  gap: 4px;
}
.grow {
  flex: 1;
}
.chip-btn {
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--dim);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip-btn .ic {
  width: 16px;
  height: 16px;
}
.chip-btn:hover {
  background: var(--hover);
  color: var(--fg);
}
.chip-btn.round {
  width: 32px;
  padding: 0;
  justify-content: center;
}
.chip-btn[aria-pressed='true'] {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-fg);
  transition: filter 0.15s, background 0.15s;
}
.send:hover {
  filter: brightness(1.1);
}
.send:disabled {
  background: var(--hover);
  color: var(--faint);
  filter: none;
}
.send.stop .ic {
  fill: currentColor;
  width: 14px;
  height: 14px;
}
.fine {
  max-width: 780px;
  margin: 8px auto 0;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}

.menu {
  position: fixed;
  z-index: 60;
  min-width: 210px;
  max-width: calc(100vw - 20px);
  background: var(--raise);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  animation: rise 0.14s var(--ease);
}
.menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 9px;
  font-size: 13.5px;
  text-align: left;
}
.menu button:hover {
  background: var(--hover);
}
.menu button.danger {
  color: var(--danger);
}
.menu .opt {
  align-items: flex-start;
  flex-direction: column;
  gap: 1px;
}
.menu .opt small {
  color: var(--faint);
  font-size: 12px;
}
.menu .opt[aria-checked='true'] {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.menu .opt[aria-checked='true'] b {
  color: var(--accent);
}
.menu hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 6px 4px;
}
.menu-label {
  padding: 6px 10px 4px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 3px;
  margin: 2px 4px 4px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.seg button {
  justify-content: center;
  padding: 6px 4px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--dim);
}
.seg button[aria-checked='true'] {
  background: var(--hover);
  color: var(--fg);
}

dialog {
  background: var(--raise);
  color: var(--fg);
  border: 1px solid var(--line-2);
  border-radius: 18px;
  padding: 0;
  width: min(560px, calc(100vw - 24px));
  max-height: min(86dvh, 760px);
  margin: auto;
  overflow: hidden;
}
dialog[open] {
  display: flex;
  flex-direction: column;
  animation: rise 0.18s var(--ease);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}
.dlg {
  padding: 22px;
  display: grid;
  gap: 10px;
}
.dlg h2 {
  font-size: 17px;
  font-weight: 600;
}
.dlg p {
  color: var(--dim);
}
.dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.pref-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px 22px;
  border-bottom: 1px solid var(--line);
}
.pref-head h2 {
  font-size: 17px;
  font-weight: 600;
}
.pref-body {
  overflow-y: auto;
  padding: 6px 22px 22px;
}
.pref-sec {
  display: grid;
  gap: 10px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.pref-sec:last-child {
  border-bottom: 0;
}
.pref-sec h3 {
  font-size: 13px;
  font-weight: 600;
}
.pref-sec p,
.pref-sec small {
  color: var(--faint);
  font-size: 12.5px;
  line-height: 1.5;
}
.themes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.theme-card {
  display: grid;
  gap: 8px;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  font-size: 12.5px;
  text-align: left;
}
.theme-card[aria-checked='true'] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}
.swatch {
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.swatch i {
  display: block;
  width: 18px;
  height: 5px;
  border-radius: 3px;
}
.field {
  display: grid;
  gap: 6px;
}
.field label {
  font-size: 12.5px;
  color: var(--dim);
}
.input,
.field textarea,
.field select {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  outline: 0;
  transition: border-color 0.15s;
}
.field textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
}
.input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.switch {
  width: 40px;
  height: 24px;
  border-radius: 999px;
  background: var(--line-2);
  position: relative;
  flex: none;
  transition: background 0.18s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--fg);
  transition: transform 0.18s var(--ease);
}
.switch[aria-checked='true'] {
  background: var(--accent);
}
.switch[aria-checked='true']::after {
  transform: translateX(16px);
  background: var(--accent-fg);
}
.note-ok {
  color: var(--accent);
}
.note-bad {
  color: var(--danger);
}

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 90;
  width: max-content;
  max-width: calc(100vw - 24px);
}
.toast {
  background: var(--raise);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13.5px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  animation: rise 0.2s var(--ease);
}
.toast.bad {
  border-color: color-mix(in srgb, var(--danger) 55%, transparent);
}
.toast.out {
  opacity: 0;
  transition: opacity 0.3s;
}

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow: auto;
}
body.gate-body {
  overflow: auto;
}
.card {
  width: min(380px, 100%);
  display: grid;
  gap: 22px;
}
.card .brand {
  font-size: 17px;
}
.card h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.card .lead {
  color: var(--dim);
  margin-top: 6px;
}
.card form {
  display: grid;
  gap: 14px;
}
.pass {
  position: relative;
}
.pass .input {
  padding-right: 44px;
}
.pass button {
  position: absolute;
  right: 4px;
  top: 3px;
}
.form-msg {
  min-height: 20px;
  font-size: 13.5px;
  color: var(--danger);
}
.card .btn.primary {
  height: 42px;
  font-size: 14.5px;
}
.card .fine {
  margin: 0;
  text-align: left;
}

@media (max-width: 820px) {
  .app,
  .app.collapsed {
    grid-template-columns: minmax(0, 1fr);
  }
  .app.collapsed .side {
    visibility: visible;
  }
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(88vw, 330px);
    transform: translateX(-102%);
    transition: transform 0.26s var(--ease);
  }
  .app.drawer .side {
    transform: none;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.6);
  }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s;
  }
  .app.drawer .scrim {
    opacity: 1;
    pointer-events: auto;
  }
  .top .open-side,
  .app.collapsed .top .open-side {
    display: inline-grid;
  }
  #side_close {
    display: none;
  }
  .app.drawer #side_close {
    display: inline-grid;
  }
  .thread {
    padding: 8px 14px 28px;
    gap: 22px;
  }
  .dock {
    padding: 0 10px calc(8px + env(safe-area-inset-bottom));
  }
  .fine {
    display: none;
  }
  .bubble {
    max-width: 92%;
  }
  .foot {
    opacity: 1;
  }
  .item-more {
    opacity: 1;
  }
  .empty {
    margin-top: 6vh;
  }
  .empty h2 {
    font-size: 24px;
  }
  .themes {
    grid-template-columns: repeat(2, 1fr);
  }
  .to-bottom {
    bottom: 118px;
  }
  .composer textarea {
    font-size: 16px;
  }
}

@media (pointer: coarse) {
  .item-more {
    width: 36px;
    height: 36px;
  }
  .code-copy {
    height: 32px;
    padding: 0 12px;
  }
  .act {
    width: 36px;
    height: 36px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.pick.file {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 58px;
  max-width: 230px;
  padding: 0 14px 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--raise);
  color: var(--fg);
}
.pick.file .ic {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--accent);
}
.pick.file .fn,
.file-chip .fn,
.file-card .fn {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}
.pick.file small,
.file-chip small,
.file-card small {
  flex: none;
  color: var(--faint);
  font-size: 12px;
}
.file-chip,
.file-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--bg, transparent);
  color: var(--fg);
  text-decoration: none;
}
.file-chip .ic,
.file-card .ic {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.file-card {
  padding: 10px 14px;
  background: var(--raise);
}
.file-card .ic:last-child {
  color: var(--faint);
}
a.file-chip:hover,
a.file-card:hover {
  background: var(--hover);
}
.files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 2px;
}
.files[hidden] {
  display: none;
}

dialog.wide {
  width: min(900px, calc(100vw - 16px));
  height: min(88dvh, 820px);
}
.row-btns {
  display: flex;
  gap: 4px;
}
iframe.viewer {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}
.ws .pref-sec {
  display: grid;
  gap: 10px;
}
.ws-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.ws-bar .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ws-bar .ic {
  width: 15px;
  height: 15px;
}
.ws-state {
  margin-left: auto;
  color: var(--faint);
  font-size: 12px;
}
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin-bottom: 6px;
  color: var(--faint);
  font-size: 13px;
}
.crumb {
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--dim);
}
.crumb:hover {
  background: var(--hover);
  color: var(--fg);
}
.ws-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.ws-row {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px 2px 0;
  border-top: 1px solid var(--line);
}
.ws-row:first-child {
  border-top: 0;
}
.ws-name {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  text-align: left;
  border-radius: 8px;
}
.ws-name:hover {
  background: var(--hover);
}
.ws-name .ic {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.ws-name .fn {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ws-name small {
  margin-left: auto;
  flex: none;
  color: var(--faint);
  font-size: 12px;
}
.ws-empty {
  padding: 16px;
  color: var(--faint);
}
.console-out {
  max-height: 260px;
  min-height: 80px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.cmd-in {
  color: var(--accent);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.cmd-out {
  margin: 2px 0 10px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--dim);
  font: inherit;
}
.console-in {
  display: flex;
  align-items: center;
  gap: 8px;
}
.console-in .ps {
  color: var(--accent);
  font-family: ui-monospace, monospace;
}
.console-in .input {
  flex: 1;
}
.input.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.steps {
  display: grid;
  gap: 6px;
  margin: 4px 0 10px;
}
.steps[hidden] {
  display: none;
}
.step {
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
}
.step summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
}
.step summary::-webkit-details-marker {
  display: none;
}
.step summary .ic {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--accent);
}
.step summary code {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.step summary small {
  flex: none;
  color: var(--faint);
  font-size: 12px;
}
.step summary small.bad {
  color: var(--danger);
}
.step-out {
  margin: 0;
  max-height: 320px;
  overflow: auto;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--dim);
  font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.file-pair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}
.view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
}
.view-btn .ic {
  width: 15px;
  height: 15px;
}
