:root {
  color-scheme: dark;
  --bg: #0f1117;
  --panel: #171b24;
  --panel-2: #202632;
  --text: #f5f7fb;
  --muted: #a9b2c3;
  --line: #2d3544;
  --accent: #37c77f;
  --accent-strong: #18a866;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(55, 199, 127, 0.18), transparent 32rem),
    linear-gradient(140deg, #0f1117 0%, #141926 55%, #10131a 100%);
  color: var(--text);
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.chat {
  width: min(960px, 100%);
  height: min(760px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: rgba(23, 27, 36, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
}

.chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(32, 38, 50, 0.82);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 28px;
}

.status {
  min-width: 92px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #303747;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.status.is-online {
  background: rgba(55, 199, 127, 0.14);
  color: var(--accent);
}

.status.is-error {
  background: rgba(255, 107, 107, 0.14);
  color: var(--danger);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  overflow-y: auto;
}

.message {
  width: fit-content;
  max-width: min(720px, 92%);
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  line-height: 1.5;
}

.message strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 13px;
}

.message p {
  margin: 0;
  white-space: pre-wrap;
}

.message--user {
  align-self: flex-end;
  background: #263247;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: rgba(32, 38, 50, 0.82);
}

textarea {
  width: 100%;
  min-height: 52px;
  max-height: 180px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #10141d;
  color: var(--text);
  font: inherit;
}

textarea:focus {
  outline: 2px solid rgba(55, 199, 127, 0.38);
  border-color: var(--accent);
}

button {
  min-width: 108px;
  height: 52px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #07100b;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

@media (max-width: 640px) {
  .shell {
    padding: 0;
  }

  .chat {
    height: 100vh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }
}
