:root {
  color-scheme: dark;
  --bg: #101310;
  --panel: #151915;
  --line: #303a31;
  --text: #e5eae3;
  --muted: #9ca99b;
  --green: #b3d99b;
  --amber: #e3bf79;
  font: 14px/1.55 ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",monospace;
  background: var(--bg);
  color: var(--text)
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  -webkit-text-size-adjust: 100%
}

.app-download {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-top: .75rem;
  color: var(--muted);
  text-decoration: none;
}

.app-download:hover {
  color: var(--green);
}

.access-gate {
  width: min(100%, 28rem);
  margin: clamp(3rem, 12vh, 8rem) auto;
}

.access-gate h1 {
  margin: 1.5rem 0 0.75rem;
}

.access-gate form {
  display: grid;
  gap: 0.75rem;
  margin-top: 2rem;
}

.access-gate input {
  width: 100%;
  min-width: 0;
}

.access-gate #site-access-status {
  min-height: 1.5em;
  color: var(--amber);
}

button,input,textarea,select {
  font: inherit
}

button,input,textarea,select {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text)
}

button {
  padding: .65rem .85rem;
  min-height: 44px;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s
}

button:hover:not(:disabled) {
  background: #263026;
  border-color: #60705b
}

button:disabled {
  cursor: not-allowed;
  opacity: .45
}

input,select {
  padding: .65rem;
  min-width: 0;
  width: 100%;
  min-height: 44px
}

textarea {
  resize: vertical;
  width: 100%;
  min-height: 88px;
  max-height: 280px;
  padding: .85rem;
  border: 0;
  background: transparent;
  display: block
}

input[readonly] {
  color: var(--green);
  font-size: .79rem
}

button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,a:focus-visible,summary:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px
}

p {
  margin: .6rem 0 1rem
}

h1 {
  font-size: 1.25rem;
  margin: 0 0 .4rem;
  font-weight: 500
}

h2 {
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 .65rem
}

a {
  color: inherit
}

.shell {
  max-width: 1200px;
  margin: auto;
  padding: 0 28px
}

.masthead {
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line)
}

.mobile-model-slot,.mobile-chat-slot,.balance-toggle {
  display: none
}

.balance-chevron {
  width: 7px;
  height: 7px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg)
}

.balance-toggle[aria-expanded="true"] .balance-chevron {
  transform: rotate(225deg)
}

.wordmark {
  font-size: 1.45rem;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -.06em
}

.wordmark span {
  color: var(--green)
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px
}

.powered-by {
  font-size: .65rem;
  color: var(--muted);
  letter-spacing: .015em
}

.network,.eyebrow {
  font-size: .75rem;
  color: var(--muted);
  letter-spacing: .1em
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(0,1fr);
  min-height: calc(100dvh - 82px)
}

.sidebar {
  padding: 28px 24px 32px 0;
  border-right: 1px solid var(--line);
  min-width: 0
}

.sidebar button {
  width: 100%
}

.muted {
  color: var(--muted)
}

.small {
  font-size: .78rem
}

.primary {
  background: var(--green);
  border-color: var(--green);
  color: #14200f;
  font-weight: 600
}

.primary.stop {
  background: transparent;
  color: var(--green)
}

.primary:hover:not(:disabled) {
  background: #cae9b7;
  border-color: #cae9b7
}

.restore-form {
  margin-top: 30px;
  padding-top: 23px;
  border-top: 1px solid var(--line)
}

.welcome-steps {
  margin: .75rem 0 0
}

.account-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px
}

.account-summary #forget-key {
  width: auto;
  flex-shrink: 0;
  padding: .5rem 0 .5rem .5rem;
  border-color: transparent;
  font-size: .78rem
}

label {
  display: block;
  font-size: .8rem;
  margin-bottom: .45rem
}

.input-row {
  display: flex;
  gap: 7px
}

.input-row button {
  width: auto
}

.balance {
  font-size: 2rem;
  display: block;
  overflow-wrap: anywhere;
  letter-spacing: -.06em;
  margin-top: .25rem
}

.funding-status {
  font-size: .82rem;
  color: var(--green)
}

.amber {
  color: var(--amber)
}

.key-panel,.deposit-panel {
  padding: 18px 0;
  border-top: 1px solid var(--line)
}

.key-panel {
  color: var(--amber)
}

.key-panel button,.deposit-panel button {
  margin-top: 8px
}

summary {
  cursor: pointer
}

.deposit-panel > summary {
  color: var(--green);
  font-size: .92rem
}

.deposit-panel[open] > summary {
  margin-bottom: .8rem
}

.key-panel input {
  color: var(--text)
}

#deposit-address,#saved-access-key {
  min-height: 4.5em;
  max-height: none;
  resize: none;
  padding: .65rem;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--green);
  font-size: .85rem;
  line-height: 1.6;
  overflow-wrap: anywhere
}

.saved-key-details {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line)
}

.saved-key-details > summary {
  color: var(--muted);
  font-size: .8rem
}

.saved-key-details[open] > summary {
  margin-bottom: .65rem
}

#saved-access-key {
  color: var(--text)
}

.quiet {
  background: transparent;
  color: var(--muted)
}

.conversation {
  min-width: 0;
  padding: 26px 0 18px 30px;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 82px);
  min-height: 600px
}

.chat-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px
}

.model-field {
  width: 280px;
  max-width: 70%;
  position: relative;
  min-width: 0
}

.model-price {
  position: absolute;
  left: 0;
  top: 1.7rem;
  z-index: 2;
  width: min(26rem, calc(100vw - 32px));
  margin: 0;
  padding: .8rem;
  border: 1px solid var(--line);
  background: var(--panel)
}

.model-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px
}

.prices-details > summary {
  color: var(--muted);
  font-size: .72rem;
  list-style: none;
  text-decoration: underline;
  text-underline-offset: .2em
}

.prices-details > summary::-webkit-details-marker {
  display: none
}

.chat-log {
  flex: 1;
  overflow: auto;
  min-height: 180px;
  overscroll-behavior: contain;
  padding: 10px 5px 20px 0;
  scrollbar-color: var(--line) var(--bg)
}

.empty-chat {
  padding: 70px 8px;
  color: var(--muted)
}

.empty-chat h2 {
  color: var(--text);
  font-size: clamp(1.35rem,2.3vw,1.9rem);
  line-height: 1.3;
  letter-spacing: -.035em;
  margin-top: 18px
}

.empty-chat h2 span {
  display: block;
  color: var(--green)
}

.prompt-mark {
  font-size: 2rem;
  color: var(--green)
}

.message {
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere
}

.message-label {
  color: var(--green);
  font-size: .75rem;
  letter-spacing: .06em;
  margin: 0
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px
}

.copy-reply {
  min-width: 48px;
  min-height: 32px;
  padding: .25rem .5rem;
  font-size: .72rem;
  border-color: transparent
}

.message.user .message-label {
  color: var(--muted)
}

.message-text {
  white-space: pre-wrap;
  margin: 0;
  line-height: 1.75
}

.message.assistant.pending .message-text::after {
  content: "";
  display: inline-block;
  width: .55em;
  height: 1em;
  margin-left: .25em;
  vertical-align: -.12em;
  background: var(--green);
  animation: terminal-cursor 1.1s steps(1, end) infinite
}

@keyframes terminal-cursor {
  50% { opacity: 0 }
}

.message-cost {
  font-size: .75rem;
  color: var(--muted);
  margin: .8rem 0 0
}

.message.pending .message-cost {
  color: var(--amber)
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  margin: 5px 0
}

.status-row p {
  font-size: .8rem;
  margin: 0;
  flex: 1;
  color: var(--muted);
  overflow-wrap: anywhere
}

.status-row p[data-tone="error"],.status-row p[data-tone="pending"] {
  color: var(--amber)
}

.status-row button {
  font-size: .75rem;
  white-space: nowrap
}

.composer {
  border: 1px solid #485643;
  background: var(--panel);
  border-radius: 4px
}

.composer:focus-within {
  border-color: var(--green)
}

.composer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px 12px
}

.composer-bottom .keyboard-hint { flex: 1 }
.attach-control { position: relative; display: inline-flex; flex: 0 0 auto; border-radius: 3px }
.attach-control:focus-visible { outline: 2px solid var(--green); outline-offset: 2px }
.attach-image { width: 44px; padding: 8px; display: grid; place-items: center; border-color: transparent }
.image-hint { display: none; position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 2; width: min(260px, 70vw); padding: 8px 10px; border: 1px solid var(--line); border-radius: 3px; background: var(--bg); color: var(--text); font-size: .75rem; white-space: normal; pointer-events: none }
.attach-control[data-disabled="true"]:hover .image-hint,.attach-control[data-disabled="true"]:focus-within .image-hint,.attach-control[data-disabled="true"]:focus .image-hint { display: block }
.image-draft { display: flex; align-items: center; gap: 10px; padding: 10px 12px 0; min-height: 64px }
.image-draft img { display: block; width: 64px; height: 64px; object-fit: contain; border: 1px solid var(--line); background: #fff; border-radius: 3px }
.image-draft button { margin-left: auto; min-width: 44px; font-size: 1.2rem; padding: 0 }
.image-draft #image-progress { max-width: 210px; overflow-wrap: anywhere }
.message-image { display: block; width: auto; height: auto; max-width: min(100%, 320px); max-height: 260px; margin: 0 0 10px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 3px }
.message-image-status { color: var(--muted); font-size: .75rem }

.composer-bottom .small {
  font-size: .7rem
}

[hidden] {
  display: none!important
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0
}

@media(max-width:860px) {
  .shell {
    padding: 0 16px
  }
  .masthead {
    height: 64px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 44px 44px;
    gap: 6px
  }
  .masthead .brand {
    min-width: 0
  }
  .masthead .wordmark {
    font-size: 1.15rem
  }
  .masthead .powered-by {
    font-size: .58rem
  }
  .mobile-model-slot,.mobile-chat-slot {
    display: block;
    min-width: 0
  }
  .mobile-model-slot .model-label-row {
    display: none
  }
  .mobile-model-slot select {
    padding: .55rem .35rem;
    font-size: 16px
  }
  .mobile-chat-slot #new-chat {
    width: 44px;
    padding: 0;
    font-size: 0;
    border-color: transparent
  }
  .mobile-chat-slot #new-chat::before {
    content: "+";
    font-size: 23px;
    line-height: 1
  }
  .balance-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 44px;
    height: 44px;
    padding: 0;
    border-color: transparent;
    color: var(--green)
  }
  .balance-symbol {
    font-size: 12px
  }
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(460px, 1fr);
    height: calc(100dvh - 64px);
    min-height: 0
  }
  .sidebar {
    grid-row: 1;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 18px 0
  }
  .sidebar[data-open="false"] {
    display: none
  }
  .sidebar #welcome-panel {
    max-width: 440px
  }
  .restore-form {
    margin-top: 20px;
    padding-top: 18px
  }
  .conversation {
    grid-row: 2;
    padding: 18px 0 max(14px, env(safe-area-inset-bottom));
    min-height: 0;
    max-height: none
  }
  .chat-log {
    max-height: none;
    min-height: 100px;
    overscroll-behavior: auto
  }
  .message-image {
    max-width: min(100%, 160px);
    max-height: 120px
  }
  .empty-chat {
    display: none
  }
  .model-field {
    flex: 1;
    width: auto;
    max-width: none
  }
  .chat-toolbar {
    display: none
  }
  .balance {
    font-size: 1.7rem
  }
  .key-panel,.deposit-panel {
    padding: 18px 0
  }
  input,select,textarea,.sidebar input,#deposit-address,#saved-access-key {
    font-size: 16px
  }
  .composer-bottom .small {
    max-width: 210px
  }
  .network {
    font-size: .65rem
  }
  .copy-reply {
    min-height: 44px
  }
  .composer-bottom .primary {
    flex-shrink: 0
  }
}

@media(hover:none) and (pointer:coarse) {
  .keyboard-hint {
    display: none
  }
  .composer-bottom {
    justify-content: space-between
  }
}

@media(prefers-reduced-motion:reduce) {
  button {
    transition: none
  }
  .message.assistant.pending .message-text::after {
    animation: none;
    opacity: .7
  }
}
