:root {
  --bg: #0a0a0a;
  --surface: #121212;
  --surface-2: #1a1a1a;
  --surface-3: rgba(255, 255, 255, 0.05);
  --fg: #f4f4f4;
  --muted: #9b9b9b;
  --dim: #5f5f5f;
  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 120ms;
  --dur: 220ms;
  --dur-slow: 700ms;
  --font: "Google Sans Flex", "Google Sans", "Product Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sidebar-w: 300px;
  --gutter: clamp(12px, 3vw, 24px);
  --col: 760px;
  --kb: 0px;
  --vv-top: 0px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

h1,
h2,
p,
ul {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

h1,
h2 {
  font-weight: 500;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
}

button,
select,
textarea,
input {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

::selection {
  background: #f4f4f4;
  color: #0a0a0a;
}

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
  border-radius: 8px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--fg);
  color: var(--bg);
  border-radius: var(--radius-pill);
  translate: 0 -200%;
  transition: translate var(--dur) var(--ease);
}

.skip:focus-visible {
  translate: 0 0;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  text-align: center;
}

.net {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

.shell {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  transform: translate3d(0, var(--vv-top), 0);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), transform 320ms var(--ease);
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--fg);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn[aria-expanded="true"] {
  background: var(--surface-2);
  color: var(--fg);
}

.text-btn {
  color: var(--muted);
  font-size: 0.9375rem;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}

.text-btn:hover {
  color: var(--fg);
  text-decoration-color: currentColor;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  background: var(--fg);
  color: var(--bg);
  font-weight: 500;
  white-space: nowrap;
  transition: transform 320ms var(--ease), background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.btn:hover {
  background: #ffffff;
  transform: translate3d(0, -1px, 0);
}

.btn:active {
  transform: scale(0.96);
}

.btn[data-quiet] {
  background: #2f2f2f;
  color: var(--fg);
}

.btn[data-quiet]:hover {
  background: #383838;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: min(320px, 86vw);
  padding: calc(var(--safe-t) + 14px) 14px calc(var(--safe-b) + 14px) calc(var(--safe-l) + 14px);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transform: translate3d(-102%, 0, 0);
  visibility: hidden;
  transition: transform 520ms var(--ease), visibility 0s linear 520ms;
}

.sidebar.is-open {
  transform: none;
  visibility: visible;
  transition-delay: 0s;
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: opacity 420ms var(--ease), visibility 0s linear 420ms;
}

.scrim.is-open {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 4px 0 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

.brand img {
  border-radius: 8px;
  transition: transform var(--dur-slow) var(--ease);
}

.brand:hover img {
  transform: rotate(-8deg) scale(1.08);
}

.btn-new {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  margin: 16px 0 20px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  font-weight: 500;
  transition: background-color var(--dur) var(--ease), transform 320ms var(--ease);
}

.btn-new:hover {
  background: #232323;
}

.btn-new:active {
  transform: scale(0.98);
}

.side-title {
  margin: 0 0 8px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0;
}

.side-scroll {
  flex: 1;
  min-height: 0;
  margin: 0 -6px;
  padding: 0 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #2a2a2a transparent;
}

.side-empty {
  padding: 8px 12px;
  color: var(--dim);
  font-size: 0.9375rem;
}

.side-empty[hidden] {
  display: none;
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-item {
  position: relative;
  display: flex;
  align-items: center;
  border-radius: var(--radius);
  transition: background-color var(--dur) var(--ease);
}

.chat-item.enter {
  animation: rise 520ms var(--ease) both;
}

.chat-item:hover,
.chat-item:focus-within {
  background: var(--surface-3);
}

.chat-item.is-active {
  background: var(--surface-2);
}

.chat-open {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  text-align: left;
  border-radius: var(--radius);
}

.chat-open .t {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9375rem;
}

.chat-open .d {
  display: block;
  color: var(--dim);
  font-size: 0.8125rem;
}

.chat-actions {
  display: flex;
  flex: none;
  padding-right: 4px;
}

.chat-actions .icon-btn {
  width: 40px;
  height: 40px;
}

.chat-actions svg {
  width: 18px;
  height: 18px;
}

.chat-rename {
  flex: 1;
  min-width: 0;
  margin: 4px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  outline: 2px solid var(--fg);
  outline-offset: 0;
}

.main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(var(--safe-t) + 8px) calc(var(--gutter) + var(--safe-r) - 8px) 8px calc(var(--gutter) + var(--safe-l) - 8px);
  background: var(--bg);
}

.topbar::after {
  content: "";
  position: absolute;
  inset: 100% 0 auto 0;
  height: 24px;
  pointer-events: none;
  background: linear-gradient(to bottom, var(--bg), rgba(10, 10, 10, 0));
}

.top-actions {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 44px;
  padding: 0 14px 0 18px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: background-color var(--dur) var(--ease), transform 320ms var(--ease);
}

.picker-btn:hover {
  background: #232323;
}

.picker-btn:active {
  transform: scale(0.97);
}

.picker-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chev {
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform 420ms var(--ease);
}

.picker-btn[aria-expanded="true"] .chev {
  transform: rotate(180deg);
}

.drop {
  position: absolute;
  top: calc(100% - 6px);
  z-index: 10;
  max-width: calc(100% - 2 * var(--gutter));
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)) drop-shadow(0 8px 24px rgba(0, 0, 0, 0.35));
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, -8px, 0);
  transition: opacity 220ms var(--ease), transform 520ms var(--ease), visibility 0s linear 520ms;
  pointer-events: none;
}

.drop.is-open {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
  transition-delay: 0s;
}

.drop-in {
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  clip-path: inset(0 0 100% 0);
  transition: clip-path 520ms var(--ease);
}

.drop.is-open .drop-in {
  clip-path: inset(0 0 0 0);
}

.drop-model {
  left: calc(var(--gutter) + var(--safe-l));
  width: min(380px, calc(100% - 2 * var(--gutter)));
}

.drop-export {
  right: calc(var(--gutter) + var(--safe-r));
  width: min(240px, calc(100% - 2 * var(--gutter)));
}

.menu {
  padding: 8px;
}

.drop.is-open .model-opt {
  animation: opt-in 480ms var(--ease) 120ms backwards;
}

.drop.is-open .settings > * {
  animation: field-in 520ms var(--ease) backwards;
  animation-delay: calc(90ms + var(--n, 0) * 36ms);
}

.drop.is-open .menu-item {
  animation: fade-in 320ms ease-out 140ms backwards;
}

.menu-item {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: var(--radius);
  text-align: left;
  transition: background-color var(--dur) var(--ease);
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--surface-3);
}

.menu-item:focus-visible {
  outline-offset: -2px;
}

.drop-settings {
  right: calc(var(--gutter) + var(--safe-r));
  width: min(440px, calc(100% - 2 * var(--gutter)));
}

.settings {
  max-height: calc(100dvh - 140px);
  padding: 20px 20px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #2a2a2a transparent;
}

.drop-title {
  margin-bottom: 16px;
  font-size: 1.125rem;
}

.model-list {
  padding: 8px;
}

.model-opt {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 12px;
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}

.model-opt:hover,
.model-opt:focus-visible {
  background: var(--surface-3);
}

.model-opt:focus-visible {
  outline-offset: -2px;
}

.model-opt .n {
  font-weight: 500;
}

.model-opt .m {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.875rem;
}

.model-opt .s {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.875rem;
}

.model-opt[aria-selected="true"] .s svg {
  width: 18px;
  height: 18px;
  color: var(--fg);
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.field-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.num {
  color: var(--fg);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.hint {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.875rem;
}

.hint:empty {
  display: none;
}

.seg {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
}

.seg button {
  min-height: 36px;
  padding: 0 18px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 0.9375rem;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.seg button:hover {
  color: var(--fg);
}

.seg button[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
}

select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 44px;
  padding: 0 40px 0 16px;
  border: 0;
  border-radius: var(--radius);
  background-color: var(--surface-3);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239b9b9b' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}

select option {
  background: var(--surface-2);
  color: var(--fg);
}

input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  touch-action: pan-y;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: #2f2f2f;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 4px;
  background: #2f2f2f;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--fg);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--fg);
}

.stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px calc(var(--gutter) + var(--safe-r)) calc(8px + var(--dock-h, 0px) + var(--kb)) calc(var(--gutter) + var(--safe-l));
  transition: padding-bottom 320ms var(--ease);
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #2a2a2a transparent;
}

.stage.is-empty .log {
  padding-bottom: calc(8px + var(--kb));
}

.stage.is-empty.compact .log {
  padding-bottom: calc(8px + var(--dock-h, 0px) + var(--kb));
}

.stage.compact .empty-slot {
  display: none;
}

.log:focus-visible {
  outline-offset: -4px;
}

.thread {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 100%;
  max-width: var(--col);
  min-height: 100%;
  margin: 0 auto;
}

.empty {
  margin: auto 0;
  padding: 24px 0;
}

.empty.leaving {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0;
  opacity: 0;
  transform: translate3d(0, -14px, 0);
  pointer-events: none;
  animation: none;
  transition: opacity 360ms var(--ease), transform 560ms var(--ease);
}

.empty-slot {
  margin: 22px 0 6px;
}

.tail {
  flex: none;
  height: 0;
  margin-top: -22px;
}

.empty[hidden] {
  display: none;
}

.empty img {
  margin-bottom: 20px;
  border-radius: 14px;
}

.empty h2 {
  font-size: clamp(1.75rem, 5.5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.empty .lead {
  max-width: 46ch;
  margin-top: 14px;
  color: var(--fg);
}

.empty .note {
  max-width: 46ch;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.examples {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-top: 20px;
}

.example {
  min-height: 44px;
  padding: 0;
  text-align: left;
  color: var(--fg);
  background-image: linear-gradient(var(--fg), var(--fg));
  background-repeat: no-repeat;
  background-position: 0 calc(50% + 12px);
  background-size: 0 1px;
  transition: background-size 420ms var(--ease);
}

.example:hover,
.example:focus-visible {
  background-size: 100% 1px;
}

.msg.user {
  transform-origin: 100% 100%;
  animation: user-in 520ms var(--ease) backwards;
}

.msg.model {
  animation: fade-in 480ms ease-out backwards;
}

.msg.flown,
.msg.live {
  animation: none;
}

.msg.incoming {
  opacity: 0;
}

.msg.user {
  align-self: flex-end;
  max-width: 84%;
  padding: 12px 18px;
  background: var(--surface-2);
  border-radius: 22px 22px 6px 22px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.model {
  align-self: flex-start;
  max-width: 100%;
}

.out {
  overflow-wrap: anywhere;
  line-height: 1.65;
}

.out > * + * {
  margin-top: 0.75em;
}

.md-p,
.md-h,
.out li {
  white-space: pre-wrap;
}

.md-h {
  font-weight: 600;
}

.md-list {
  padding-left: 1.35em;
}

ul.md-list {
  list-style: disc;
}

ol.md-list {
  list-style: decimal;
}

.md-list li {
  padding-left: 0.2em;
}

.md-list li + li {
  margin-top: 0.3em;
}

.md-list li::marker {
  color: var(--muted);
}

.out strong {
  font-weight: 600;
}

.out :not(pre) > code {
  padding: 0.12em 0.42em;
  border-radius: 6px;
  background: #060606;
  font-family: inherit;
  font-size: 0.95em;
}

.code {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  transform-origin: 0 0;
  animation: code-in 560ms var(--ease) backwards;
}

.code-head {
  animation: fade-in 420ms ease-out 140ms backwards;
}

.code-body {
  animation: fade-in 480ms ease-out 240ms backwards;
}

.out > .code,
.out > .code + * {
  margin-top: 0.9em;
}

.code-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 4px 6px 0 18px;
}

.code-lang {
  color: var(--muted);
  font-size: 0.9375rem;
}

.code-status {
  position: absolute;
  right: 54px;
  color: var(--muted);
  font-size: 0.875rem;
  opacity: 0;
  transform: translate3d(6px, 0, 0);
  transition: opacity var(--dur) var(--ease), transform 420ms var(--ease);
  pointer-events: none;
}

.code-status.on {
  opacity: 1;
  transform: none;
}

.code-copy {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), transform 320ms var(--ease);
}

.code-copy svg {
  width: 20px;
  height: 20px;
}

.code-copy:hover {
  background: var(--surface-3);
  color: var(--fg);
}

.code-copy:active {
  transform: scale(0.92);
}

.code-body {
  margin: 0;
  padding: 6px 20px 18px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  white-space: pre;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.6;
  tab-size: 4;
  font-variant-ligatures: none;
  scrollbar-width: thin;
  scrollbar-color: #2a2a2a transparent;
}

.code-body code {
  font: inherit;
}

.code-body:focus-visible {
  outline-offset: -3px;
}

.t-k {
  color: #b79ad9;
}

.t-f {
  color: #82b1de;
}

.t-s {
  color: #a8c98f;
}

.t-n {
  color: #d2a679;
}

.t-c {
  color: #707070;
  font-style: italic;
}

.out:empty {
  min-height: 1.65em;
}

.tk {
  position: relative;
  animation: tk-in 220ms var(--ease) both;
}

.msg-foot {
  display: flex;
  gap: 4px;
  margin: 4px 0 0 -10px;
}

.msg-foot[hidden] {
  display: none;
}

.msg-foot .text-btn {
  min-height: 40px;
  padding: 0 10px;
  font-size: 0.875rem;
}

.dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px calc(var(--gutter) + var(--safe-r)) calc(var(--safe-b) + 12px) calc(var(--gutter) + var(--safe-l));
  transform: translate3d(0, calc(var(--kb) * -1), 0);
}

.stage.is-empty .dock {
  transform: translate3d(0, min(var(--shift, 0px), calc(var(--kb) * -1)), 0);
}

.stage.animate .dock {
  transition: transform 640ms var(--ease), padding-bottom 320ms var(--ease);
}

.kb-open .dock {
  padding-bottom: 10px;
}

.dock > * {
  width: 100%;
  max-width: var(--col);
  margin-left: auto;
  margin-right: auto;
}

.toast-row {
  position: relative;
  z-index: 15;
  display: grid;
  grid-template-rows: 0fr;
  padding: 0 calc(var(--gutter) + var(--safe-r)) 0 calc(var(--gutter) + var(--safe-l));
  visibility: hidden;
  transition: grid-template-rows 520ms var(--ease), visibility 0s linear 520ms;
}

.toast-row.on {
  grid-template-rows: 1fr;
  visibility: visible;
  transition-delay: 0s;
}

.toast-clip {
  display: flex;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}

.toast {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 100%;
  margin: 2px 0 10px;
  padding: 8px 8px 8px 20px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  box-shadow: var(--shadow-card);
  font-size: 0.9375rem;
  opacity: 0;
  transform: translate3d(0, -10px, 0) scale(0.97);
  transition: opacity 260ms var(--ease), transform 520ms var(--ease);
}

.toast-row.on .toast {
  opacity: 1;
  transform: none;
  transition-delay: 100ms;
}

.toast .text-btn {
  flex: none;
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
  font-weight: 500;
}

.toast .text-btn:hover {
  background: #ffffff;
}

.model-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 10px;
  padding: 16px 16px 16px 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  animation: rise 600ms var(--ease) both;
}

.model-card[hidden] {
  display: none;
}

.model-card h2 {
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.model-card p {
  color: var(--muted);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.card-note {
  margin-top: 6px;
}

.card-note button {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.card-note[hidden] {
  display: none;
}

.bar {
  grid-column: 1 / -1;
  height: 4px;
  overflow: hidden;
  border-radius: 4px;
  background: #2a2a2a;
}

.bar[hidden] {
  display: none;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--fg);
  transform: scaleX(var(--p, 0));
  transform-origin: left;
  transition: transform 300ms linear;
}

.status {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  min-height: 1.75rem;
  padding: 0 6px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.status p {
  margin: 0;
}

.status-main {
  min-width: 0;
}

.status-speed {
  flex: none;
}

.shimmer {
  background: linear-gradient(100deg, #6b6b6b 0%, #6b6b6b 35%, #f4f4f4 50%, #6b6b6b 65%, #6b6b6b 100%);
  background-size: 250% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-size: 0.9375rem;
  animation: shimmer 1.8s linear infinite;
}

.error {
  min-height: 0;
  padding: 0 6px;
  color: var(--fg);
  font-size: 0.9375rem;
}

.error:not(:empty) {
  margin-bottom: 8px;
  animation: rise 420ms var(--ease) both;
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 22px;
  border-radius: 28px;
  background: var(--surface-2);
  transition: background-color var(--dur) var(--ease);
}

.composer:focus-within {
  background: #202020;
}

.composer:has(textarea:focus-visible) {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.composer textarea {
  flex: 1;
  min-width: 0;
  max-height: 168px;
  padding: 11px 0;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font-size: 1rem;
  line-height: 1.5;
}

.composer textarea::placeholder {
  color: var(--dim);
}

.send {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--fg);
  color: var(--bg);
  transition: transform 320ms var(--ease), background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.send svg {
  grid-area: 1 / 1;
  transition: opacity var(--dur) var(--ease), transform 420ms var(--ease);
}

.send .i-stop {
  fill: currentColor;
  opacity: 0;
  transform: scale(0.6);
}

.send:hover {
  background: #ffffff;
  transform: translate3d(0, -1px, 0);
}

.send:active {
  transform: scale(0.94);
}

.send.is-stop {
  background: #2f2f2f;
  color: var(--fg);
}

.send.is-stop:hover {
  background: #383838;
}

.send.is-stop .i-send {
  opacity: 0;
  transform: scale(0.6);
}

.send.is-stop .i-stop {
  opacity: 1;
  transform: none;
}

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 60;
  overflow: hidden;
  pointer-events: none;
  contain: layout paint style;
  will-change: transform, width, height;
}

.ghost-text {
  position: absolute;
  left: 18px;
  top: 12px;
  color: var(--fg);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.kb-open .stage.is-empty .empty img,
.kb-open .stage.is-empty .empty .note,
.kb-open .stage.is-empty .examples {
  display: none;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes user-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes code-in {
  from {
    opacity: 0;
    transform: scale(0.975);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes opt-in {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes field-in {
  from {
    opacity: 0;
    transform: translate3d(0, 8px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes side-in {
  from {
    opacity: 0;
    transform: translate3d(-28px, 0, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes item-in {
  from {
    opacity: 0;
    transform: translate3d(-10px, 0, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pill-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes logo-in {
  from {
    opacity: 0;
    transform: scale(0.88);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

@keyframes letter-in {
  from {
    opacity: 0;
    transform: translate3d(0, 105%, 0);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: blur(0);
  }
}

@keyframes line-in {
  from {
    opacity: 0;
    filter: blur(4px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes line-in-soft {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes example-in {
  from {
    opacity: 0;
    transform: translate3d(-12px, 0, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes composer-in {
  from {
    opacity: 0;
    transform: translate3d(0, 28px, 0) scaleX(0.96);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes send-in {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes net-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes reveal-fallback {
  to {
    opacity: 1;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translate3d(0, 16px, 0) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes tk-in {
  from {
    opacity: 0;
    top: 3px;
  }
  to {
    opacity: 1;
    top: 0;
  }
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}

.narrow-only {
  display: inline-grid;
}

@media (hover: hover) {
  .chat-actions {
    opacity: 0;
    transition: opacity var(--dur) var(--ease);
  }

  .chat-item:hover .chat-actions,
  .chat-item:focus-within .chat-actions {
    opacity: 1;
  }
}

@media (min-width: 900px) {
  .shell {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  }

  .sidebar {
    position: relative;
    inset: auto;
    z-index: 2;
    width: auto;
    box-shadow: none;
    transform: none;
    visibility: visible;
    transition: none;
  }

  .scrim {
    display: none;
  }

  .narrow-only {
    display: none;
  }

  .topbar {
    padding-left: calc(var(--gutter) + 6px);
  }

  .drop-model {
    left: calc(var(--gutter) + 6px);
  }
}

@media (max-width: 420px) {
  .drop-model,
  .drop-settings {
    left: var(--gutter);
    right: var(--gutter);
    width: auto;
  }

  .model-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .card-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .shimmer {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: var(--fg);
  }
}

.net {
  animation: net-in 1800ms ease-out backwards;
}

.intro-pending .shell {
  opacity: 0;
  animation: reveal-fallback 10ms linear 4s forwards;
}

.iw {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.14em;
  margin-bottom: -0.14em;
}

.ic {
  display: inline-block;
}

.il {
  display: inline-block;
}

.intro .sidebar,
.intro .topbar .picker-btn,
.intro .top-actions > *,
.intro .narrow-only,
.intro .status,
.intro .composer,
.intro .send,
.intro .chat-item,
.intro-empty .chat-item.enter {
  animation-fill-mode: backwards;
}

@media (min-width: 900px) {
  .intro .sidebar {
    animation: side-in 900ms var(--ease) backwards;
  }
}

.intro .chat-item {
  animation: item-in 640ms var(--ease) backwards;
  animation-delay: calc(320ms + var(--i, 0) * 60ms);
}

.intro .topbar .picker-btn {
  transform-origin: 0 50%;
  animation: pill-in 800ms var(--ease) 140ms backwards;
}

.intro .narrow-only {
  animation: fade-in 600ms ease-out 100ms backwards;
}

.intro .top-actions > * {
  animation: fade-in 600ms ease-out backwards;
}

.intro .top-actions > :nth-child(1) {
  animation-delay: 260ms;
}

.intro .top-actions > :nth-child(2) {
  animation-delay: 340ms;
}

.intro .top-actions > :nth-child(3) {
  animation-delay: 420ms;
}

:is(.intro, .intro-empty) .empty img {
  animation: logo-in 1000ms var(--ease) 160ms backwards;
}

:is(.intro, .intro-empty) .ic {
  animation: letter-in 820ms var(--ease) backwards;
  animation-delay: calc(360ms + var(--k, 0) * 32ms);
}

:is(.intro, .intro-empty) .il {
  animation: line-in 760ms var(--ease) backwards;
  animation-delay: calc(760ms + var(--l, 0) * 110ms);
}

:is(.intro, .intro-empty) .example {
  animation: example-in 720ms var(--ease) backwards;
  animation-delay: calc(1000ms + var(--e, 0) * 100ms);
}

.intro .status {
  animation: fade-in 700ms ease-out 760ms backwards;
}

.intro .composer {
  transform-origin: 50% 100%;
  animation: composer-in 1200ms cubic-bezier(0.34, 1.35, 0.5, 1) 520ms backwards;
}

.intro .send {
  animation: send-in 760ms cubic-bezier(0.34, 1.7, 0.64, 1) 900ms backwards;
}

@media (pointer: coarse) {
  :is(.intro, .intro-empty) .il {
    animation-name: line-in-soft;
  }
}

.intro .model-card {
  animation: fade-in 700ms ease-out 900ms backwards;
}

.stage.compact .dock::before {
  content: "";
  position: absolute;
  inset: -26px 0 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(10, 10, 10, 0), var(--bg) 26px);
}

.log {
  overflow-anchor: auto;
}

.tail {
  overflow-anchor: none;
}

.scroll-down {
  position: absolute;
  bottom: 100%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 0 10px -22px;
  border-radius: 50%;
  background: var(--surface-2);
  box-shadow: var(--shadow-card);
  color: var(--fg);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.7);
  pointer-events: none;
  transition: opacity 220ms var(--ease), transform 480ms var(--ease), visibility 0s linear 480ms, background-color var(--dur) var(--ease);
}

.scroll-down.show {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
  transition-delay: 0s;
}

.scroll-down:hover {
  background: #232323;
}

.scroll-down:active {
  transform: scale(0.92);
}

.promo {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: var(--safe-t) var(--safe-r) var(--safe-b) var(--safe-l);
  background: var(--bg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 560ms var(--ease), visibility 0s linear 560ms;
}

.promo.on {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.promo video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg);
  opacity: 0;
  transition: opacity 420ms var(--ease);
}

.promo.playing video {
  opacity: 1;
}

.promo-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  transition: opacity 420ms var(--ease), transform 600ms var(--ease), visibility 0s linear 600ms;
}

.promo-card img {
  border-radius: 18px;
}

.promo-name {
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.promo-card .btn {
  min-width: 140px;
  transition: opacity 420ms var(--ease), transform 320ms var(--ease), background-color var(--dur) var(--ease);
}

.promo-card[data-state="trying"] .btn {
  opacity: 0;
  pointer-events: none;
}

.promo.playing .promo-card {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.96);
  pointer-events: none;
}

.promo-skip {
  position: absolute;
  top: calc(var(--safe-t) + 14px);
  right: calc(var(--safe-r) + 14px);
  z-index: 2;
  min-height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  background: rgba(26, 26, 26, 0.86);
  color: var(--fg);
  font-weight: 500;
  transition: background-color var(--dur) var(--ease), transform 320ms var(--ease);
}

.promo-skip:hover {
  background: #2b2b2b;
}

.promo-skip:active {
  transform: scale(0.96);
}

.promo-first.intro-pending .shell {
  animation: none;
}
