:root {
  color-scheme: dark;
  font-family: "Avenir Next", Avenir, system-ui, sans-serif;
  background: #080809;
  color: #f2f2f2;
  --muted: #adadb2;
  --accent: #e0e0e3;
  --line: #353538;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 12% 28%, #aaa8 0 1px, transparent 1.6px),
    radial-gradient(circle at 26% 76%, #aaa6 0 1px, transparent 1.6px),
    radial-gradient(circle at 70% 18%, #aaa7 0 1px, transparent 1.6px),
    radial-gradient(circle at 86% 65%, #aaa8 0 1px, transparent 1.6px),
    radial-gradient(circle at 92% 34%, #aaa6 0 1px, transparent 1.6px),
    radial-gradient(ellipse at 50% 40%, #18181b, #080809 66%);
}
.topbar {
  position: relative;
  z-index: 1;
  height: 76px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  padding: .24rem .53rem;
  border-radius: .4rem;
  background: #ededee;
  color: #080809;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: .05em;
  line-height: 1.2;
}
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .65; }
button:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#new-chat, .retry {
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--line);
  padding: .55rem .9rem;
  border-radius: .7rem;
  font-size: .875rem;
}
#workspace {
  width: min(100% - 36px, 864px);
  min-height: calc(100dvh - 76px);
  margin: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: min(14vh, 110px);
}
.welcome {
  margin-bottom: clamp(24px, 5vw, 44px);
  text-align: center;
}
h1 {
  margin: 0 0 14px;
  font-weight: 650;
  font-size: clamp(2.25rem, 7vw, 4.5rem);
  letter-spacing: -.065em;
  line-height: 1.06;
}
.welcome p {
  max-width: 36rem;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.6;
  text-wrap: pretty;
}
.composer form {
  padding: 12px;
  display: flex;
  align-items: end;
  gap: 10px;
  background: #18181a;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 14px 45px #0008;
}
.composer form:focus-within { border-color: #77777d; }
body:not(.is-chat) .composer form { min-height: 126px; }
body:not(.is-chat) textarea { min-height: 100px; }
textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  field-sizing: content;
  min-height: 46px;
  max-height: 160px;
  padding: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  overflow-y: auto;
  line-height: 1.5;
}
textarea:focus-visible { outline: none; }
textarea::placeholder { color: var(--muted); }
#send {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  height: 42px;
  background: #242427;
  color: #f2f2f2;
  border: 1px solid #444448;
  border-radius: 8px;
  padding: 0;
}
#send:hover:not(:disabled) { background: #343437; }
.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: .8125rem;
  text-align: center;
}
.hint span { margin: 0 .3rem; }
.is-chat { background: #080809; }
.is-chat .welcome { display: none; }
.is-chat #workspace {
  justify-content: start;
  padding-bottom: 0;
}
.is-chat .composer {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 16px 0 max(14px, env(safe-area-inset-bottom));
  background: #080809;
}
#messages { padding-top: 20px; }
.message {
  margin-bottom: 24px;
  padding: 18px 20px;
  border-radius: 15px;
  line-height: 1.65;
}
.message[data-role="user"] {
  margin-left: clamp(0px, 10vw, 100px);
  border: 1px solid var(--line);
  background: #18181a;
}
.message[data-role="assistant"] { padding-left: 4px; }
.message h2 {
  margin: 0 0 6px;
  font-size: .875rem;
  font-weight: 700;
  color: var(--accent);
}
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.usage { margin: 12px 0 0; color: var(--muted); font-size: .8125rem; }
.retry { margin-top: 12px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (max-width: 500px) {
  .topbar { height: 62px; }
  #workspace { min-height: calc(100dvh - 62px); }
  .composer form { padding: 8px; }
  .hint { display: none; }
}
