:root {
  color-scheme: dark;
  --background: #10131a;
  --surface: #181d27;
  --surface-raised: #1f2633;
  --surface-muted: #151a23;
  --border: rgba(255, 255, 255, 0.11);
  --text: #f1f4fa;
  --muted: #9da7b8;
  --accent: #a8e5ff;
  --accent-strong: #6bd1fb;
  --danger: #ffb3b3;
  --success: #b6f1c3;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(76, 144, 201, 0.17), transparent 32rem),
    var(--background);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
}

a {
  color: var(--accent);
}

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

button,
select {
  cursor: pointer;
}

.shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 64px 0 44px;
}

.hero {
  max-width: 720px;
  margin-bottom: 36px;
}

.hero.compact {
  margin-bottom: 28px;
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 14ch;
  margin-bottom: 14px;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  letter-spacing: -0.055em;
  line-height: 1.02;
}

h2 {
  margin-bottom: 7px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.lede,
.hint {
  color: var(--muted);
}

.lede {
  max-width: 54ch;
  margin-bottom: 0;
}

.status {
  min-height: 24px;
  margin-bottom: 18px;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: var(--success);
}

.auth-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  align-items: end;
  gap: 20px;
  margin-bottom: 16px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-muted);
}

.auth-card h2 {
  margin-bottom: 4px;
}

.auth-card .hint {
  margin-bottom: 0;
}

.steps {
  display: grid;
  gap: 16px;
}

.step-card,
.chat-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 20px;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.055), transparent 48%), var(--surface);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

.step-number {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.hint {
  margin-bottom: 20px;
  font-size: 14px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

label.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 11px;
  outline: 0;
  background: var(--surface-muted);
  color: var(--text);
  padding: 11px 13px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(107, 209, 251, 0.14);
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 750;
  transition: transform 160ms ease, opacity 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.5;
  transform: none;
}

.button.primary {
  background: var(--accent);
  color: #10202a;
}

.button.secondary {
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text);
}

.button.ghost {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
}

.chat-card {
  display: block;
}

.chat-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.chat-toolbar h2 {
  margin-bottom: 0;
}

.key-field {
  min-width: min(320px, 100%);
}

.messages {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 260px;
  max-height: 52vh;
  overflow-y: auto;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--surface-muted);
}

.empty-state {
  align-self: center;
  margin: auto;
  color: var(--muted);
  text-align: center;
}

.message {
  max-width: min(78ch, 86%);
  margin: 0;
  padding: 10px 13px;
  border-radius: 13px;
  white-space: pre-wrap;
}

.message.user {
  justify-self: end;
  background: var(--accent);
  color: #10202a;
}

.message.assistant {
  justify-self: start;
  background: var(--surface-raised);
}

.composer textarea {
  min-height: 84px;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 10px;
}

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

@media (max-width: 680px) {
  .shell {
    padding-top: 36px;
  }

  .auth-card {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 20px;
  }

  .step-card {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 20px;
  }

  .field-grid,
  .chat-toolbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .key-field {
    min-width: 0;
  }

  .page-footer,
  .composer-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
