:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1c1c1e;
  --muted: #6e6e73;
  --border: #e5e5e7;
  --surface: #f0f0f2;
  --flame-start: #ff9d4d;
  --flame-end: #e8341f;
  --accent-solid: #e8341f;
  --accent-fg: #ffffff;
  --error: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #f2f2f2;
    --muted: #9a9a9f;
    --border: #2c2c2e;
    --surface: #1e1e20;
    --flame-start: #ffb066;
    --flame-end: #ff5a3c;
    --accent-solid: #ff5a3c;
    --error: #ff8a80;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family:
    "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas,
    monospace;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  padding-inline: 16px;
}

.icon-chato {
  color: var(--fg);
  flex-shrink: 0;
}

.icon-chato--xs {
  width: 18px;
  height: 18px;
  color: var(--muted);
  margin-top: 3px;
}

.message-flame {
  font-size: 2rem;
  line-height: 1;
  margin-top: 3px;
  flex-shrink: 0;
}

.conversation {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-block: 18px;
  transition:
    gap 0.35s ease,
    padding-block 0.35s ease;
}

.icon-chato--brand {
  width: 100px;
  height: 100px;
  transition: width 0.35s ease, height 0.35s ease;
}

.brand-title {
  margin: 0;
  font-weight: 700;
  font-size: 3rem;
  letter-spacing: -0.01em;
  transition: font-size 0.35s ease;
}

.empty-hint {
  display: none;
}

.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-block: 8px 16px;
  font-size: 1.5rem;
}

.composer-area {
  flex-shrink: 0;
  padding-block: 16px;
}

/* Estado vazio: marca grande e composer centralizados na tela */
.app[data-state="empty"] .conversation {
  justify-content: center;
  align-items: center;
}

.app[data-state="empty"] .brand {
  flex-direction: column;
  gap: 12px;
  padding-block: 0;
  margin-bottom: 10px;
}

.app[data-state="empty"] .icon-chato--brand {
  width: 100px;
  height: 100px;
}

.app[data-state="empty"] .brand-title {
  font-size: 4.25rem;
}

.app[data-state="empty"] .empty-hint {
  display: block;
  text-align: center;
  color: var(--muted);
  margin: 0 0 18px;
  font-size: 0.95rem;
}

.app[data-state="empty"] .messages {
  display: none;
}

.app[data-state="empty"] .composer-area {
  width: 100%;
  max-width: 560px;
}

/* Estado com conversa: composer fixo embaixo, mensagens rolam */
.app[data-state="chat"] .composer-area {
  border-top: 1px solid var(--border);
}

.message {
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.user {
  align-self: flex-end;
  max-width: 85%;
  background: var(--surface);
  padding: 10px 16px;
  border-radius: 18px 18px 4px 18px;
}

.message.assistant {
  align-self: flex-start;
  max-width: 100%;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.message.assistant .message-text {
  padding-top: 1px;
}

.message.error {
  align-self: flex-start;
  color: var(--error);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 10px 10px 10px 18px;
}

.composer-input {
  flex: 1;
  border: none;
  background: transparent;
  resize: none;
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  max-height: 160px;
  color: var(--fg);
  outline: none;
}

.composer-input::placeholder {
  color: var(--muted);
}

.composer-send {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--flame-start), var(--flame-end));
  color: var(--accent-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.composer-send:disabled {
  opacity: 0.35;
  cursor: default;
}

.composer-send:focus-visible,
.composer-input:focus-visible {
  outline: 2px solid var(--accent-solid);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .app {
    padding-inline: 12px;
  }
}
