:root {
  color-scheme: dark;
  --bg: #07090f;
  --panel: #111724;
  --panel-2: #171f2e;
  --line: #2b354a;
  --text: #eef3ff;
  --muted: #9aa8be;
  --hot: #8cffd2;
  --warn: #ffd166;
  --danger: #ff5c8a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(140, 255, 210, 0.12), transparent 28%),
    radial-gradient(circle at 86% 18%, rgba(255, 92, 138, 0.16), transparent 30%),
    linear-gradient(135deg, #07090f, #0d1019 48%, #120b13);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  display: grid;
  gap: 18px;
  width: min(1100px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--hot);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 82px);
  line-height: 0.98;
  letter-spacing: 0;
}

.model-card {
  min-width: 220px;
  padding: 16px;
  border: 1px solid rgba(140, 255, 210, 0.28);
  border-radius: 8px;
  background: rgba(17, 23, 36, 0.8);
  text-align: right;
}

.model-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.model-card strong {
  display: block;
  margin-top: 6px;
  color: var(--warn);
  font-size: 20px;
}

.model-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.model-card small.is-ok {
  color: var(--hot);
}

.model-card small.is-error {
  color: #ffd5df;
}

.chat-panel {
  display: grid;
  grid-template-rows: minmax(320px, 1fr) auto auto;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 23, 36, 0.84);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  overflow: hidden;
}

.messages {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  max-height: calc(100vh - 286px);
  overflow: auto;
  overflow-x: hidden;
  padding: 18px;
}

.message {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.message.user {
  grid-template-columns: minmax(0, 1fr) 42px;
}

.message.user .avatar {
  grid-column: 2;
  grid-row: 1;
}

.message.user .bubble {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  border-color: rgba(255, 209, 102, 0.38);
  background: rgba(255, 209, 102, 0.12);
}

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--hot), var(--warn));
  color: #06100c;
  font-size: 12px;
  font-weight: 950;
}

.bubble {
  min-width: 0;
  max-width: 820px;
  padding: 14px 16px;
  border: 1px solid rgba(140, 255, 210, 0.22);
  border-radius: 8px;
  background: rgba(7, 9, 15, 0.72);
}

.bubble p {
  margin: 0;
  color: var(--text);
  line-height: 1.68;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.composer {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: rgba(7, 9, 15, 0.46);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 92px;
  max-height: 220px;
  padding: 14px;
  border: 1px solid #36425a;
  border-radius: 8px;
  outline: none;
  background: #0b101a;
  color: var(--text);
  font: inherit;
  line-height: 1.55;
}

textarea:focus {
  border-color: rgba(140, 255, 210, 0.7);
  box-shadow: 0 0 0 3px rgba(140, 255, 210, 0.12);
}

.actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
}

button {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--hot), var(--warn));
  color: #07100d;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  filter: grayscale(0.7);
}

.ghost {
  border: 1px solid rgba(140, 255, 210, 0.42);
  background: transparent;
  color: var(--hot);
}

.status {
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  overflow-wrap: anywhere;
}

.status.is-complete {
  background: rgba(140, 255, 210, 0.14);
  color: var(--hot);
  font-weight: 900;
}

.status.is-error {
  background: rgba(255, 92, 138, 0.14);
  color: #ffd5df;
  font-weight: 900;
}

@media (max-width: 760px) {
  .topbar,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .model-card {
    min-width: 0;
    text-align: left;
  }

  .messages {
    max-height: calc(100vh - 330px);
  }
}
