:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #090b10;
  color: #f2f4f8;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(102, 86, 255, 0.18), transparent 34rem),
    #090b10;
}

button,
textarea {
  font: inherit;
}

.app-shell {
  width: min(920px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 36px);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.eyebrow {
  margin: 0 0 4px;
  color: #a8a0ff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 2rem);
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #aab1bf;
  font-size: 0.84rem;
  text-align: right;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: #777e8d;
  box-shadow: 0 0 0 4px rgba(119, 126, 141, 0.12);
}

.status-dot.ready {
  background: #4ee1a0;
  box-shadow: 0 0 0 4px rgba(78, 225, 160, 0.12);
}

.status-dot.warning {
  background: #ffbd57;
  box-shadow: 0 0 0 4px rgba(255, 189, 87, 0.12);
}

.messages {
  min-height: 0;
  padding: 10px 0 30px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  width: fit-content;
  max-width: min(78ch, 88%);
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.user {
  align-self: flex-end;
  background: #6656ff;
  border-color: transparent;
}

.message.assistant {
  align-self: flex-start;
}

.message.error {
  border-color: rgba(255, 100, 100, 0.35);
  background: rgba(255, 100, 100, 0.08);
}

.message p {
  margin: 0;
}

.message-label {
  display: block;
  margin-bottom: 5px;
  color: #aab1bf;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.message.user .message-label {
  color: rgba(255, 255, 255, 0.72);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  background: rgba(18, 21, 29, 0.95);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
}

textarea {
  min-height: 48px;
  max-height: 180px;
  resize: none;
  padding: 13px 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
}

textarea::placeholder {
  color: #747c8d;
}

#send-button {
  align-self: end;
  min-width: 92px;
  height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: #f4f3ff;
  color: #11131a;
  font-weight: 800;
  cursor: pointer;
}

#send-button:disabled {
  opacity: 0.48;
  cursor: wait;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #767e8f;
  font-size: 0.76rem;
}

.text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #a8a0ff;
  cursor: pointer;
}

.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: 620px) {
  .app-shell {
    padding-top: 18px;
  }

  .topbar {
    align-items: flex-start;
  }

  .status {
    max-width: 140px;
  }

  .message {
    max-width: 94%;
  }

  footer {
    flex-direction: column;
  }
}
