:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #262421;
  --muted: #8d8984;
  --line: #ebe9e6;
  --surface: #ffffff;
  --surface-soft: #f6f5f3;
  --surface-user: #f4f3f1;
  --accent: #11100f;
  --shadow: 0 10px 24px rgba(26, 24, 22, 0.08), 0 1px 4px rgba(26, 24, 22, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-rows: 1fr auto;
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 24px 28px;
}

.conversation {
  display: grid;
  align-content: start;
  gap: 22px;
  width: min(680px, 100%);
  margin: 0 auto;
  padding: 22px 0 132px;
}

.empty-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(100vh - 200px);
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.message {
  display: grid;
  gap: 7px;
  max-width: min(82%, 620px);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
}

.message.user {
  justify-self: end;
  max-width: min(68%, 420px);
}

.message.assistant {
  justify-self: start;
}

.bubble {
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--text);
  padding: 0;
}

.message.user .bubble {
  background: var(--surface-user);
  color: var(--text);
  padding: 12px 17px;
}

.message.assistant .bubble {
  padding: 0 0 0 4px;
}

.sources {
  color: var(--muted);
  font-size: 12px;
  padding-left: 4px;
}

.composer {
  position: sticky;
  bottom: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  width: min(680px, 100%);
  min-height: 58px;
  margin: 0 auto;
  padding: 8px 8px 8px 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.input-wrap {
  min-width: 0;
}

input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 17px;
  letter-spacing: 0;
}

input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 11px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

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

.icon-button.primary {
  background: var(--accent);
  color: white;
  opacity: 0.35;
}

.composer.has-text .icon-button.primary {
  opacity: 1;
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 24px;
  padding-left: 4px;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--muted);
  animation: pulse 900ms infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 140ms;
}

.typing span:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 18px 12px 18px;
  }

  .conversation {
    width: 100%;
    padding-bottom: 112px;
  }

  .message {
    max-width: 88%;
    font-size: 15px;
  }

  .message.user {
    max-width: 78%;
  }

  .composer {
    bottom: 12px;
    min-height: 54px;
    padding: 7px 7px 7px 15px;
    border-radius: 14px;
  }

  input {
    font-size: 16px;
  }

  .icon-button {
    width: 40px;
    height: 40px;
  }
}
