:root {
  --bg: #050506;
  --panel: #111214;
  --panel-light: #191b1f;
  --ink: #f4f1ea;
  --muted: #a7a39a;
  --dim: #6f6b62;
  --line: rgba(244, 241, 234, 0.12);
  --accent: #7dd3fc;
  --bubble: #3367DD;
  --control: #2f3033;
  --font: "Inter", Arial, sans-serif;
  --text-size: 15px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--text-size);
  background: var(--bg);
  letter-spacing: 0;
}

@media (min-width: 721px) {
  body {
    height: 100vh;
    overflow: hidden;
  }
}

button,
a {
  font: inherit;
}

.app {
  width: min(100% - 36px, 820px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 0;
}

.chat {
  width: min(100%, 680px);
  display: grid;
  gap: 30px;
}

.user-message {
  justify-self: end;
  max-width: min(100%, 360px);
  padding: 14px 16px;
  border: 0;
  border-radius: 999px;
  color: var(--ink);
  background: var(--bubble);
  line-height: 1.45;
  opacity: 0;
  transform: translateY(8px);
}

.user-message.is-visible {
  animation: reveal 260ms ease forwards;
}

.prompt-shell {
  min-height: 50px;
  display: grid;
  grid-template-columns: 1fr 36px;
  gap: 8px;
  align-items: center;
  padding: 7px;
  border: 0;
  border-radius: 999px;
  background: var(--control);
  transform: translateY(0);
  transition: transform 260ms ease;
}

.prompt-shell[data-state="submitted"] {
  transform: translateY(-4px);
}

.prompt-shell[data-state="sent"] {
  transform: translateY(0);
}

.prompt-input {
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--ink);
  font-size: var(--text-size);
  line-height: 1.4;
  white-space: nowrap;
}

.prompt-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.placeholder {
  display: none;
  color: var(--muted);
}

.prompt-shell[data-state="sent"] .placeholder {
  display: inline;
}

.caret {
  width: 8px;
  height: 1.25em;
  margin-left: 2px;
  border-right: 1.5px solid var(--accent);
  animation: caretBlink 900ms steps(2, end) infinite;
}

.submit-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--bubble);
  background: var(--ink);
  opacity: 0.42;
  transition: opacity 180ms ease, transform 180ms ease, background 180ms ease;
}

.prompt-shell[data-state="ready"] .submit-button,
.prompt-shell[data-state="submitted"] .submit-button {
  opacity: 1;
}

.prompt-shell[data-state="submitted"] .submit-button {
  background: var(--ink);
  transform: scale(0.94);
}

.thinking {
  height: 18px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding-left: 8px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.thinking.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

.thinking span:nth-child(2) {
  animation-delay: 120ms;
}

.thinking span:nth-child(3) {
  animation-delay: 240ms;
}

.response {
  display: grid;
  gap: 10px;
}

.response-line {
  margin: 0;
  max-width: 640px;
  color: #d8d2c7;
  line-height: 1.75;
}

.response-line.muted {
  color: var(--muted);
}

.actions {
  display: none;
  justify-self: start;
  grid-template-columns: repeat(4, auto);
  gap: 6px;
  margin-bottom: -30px;
  padding-left: 28px;
  opacity: 0;
  transform: translateY(6px);
  z-index: 2;
}

.actions.is-visible {
  display: grid;
  animation: reveal 300ms ease forwards;
}

.action {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 8px 8px 0 0;
  color: var(--ink);
  background: #3a3b3f;
  text-decoration: none;
  font-size: 13px;
  line-height: 1;
  transition: opacity 180ms ease, background 180ms ease;
}

.action.primary {
  background: #424348;
}

.action:hover,
.action:focus-visible {
  opacity: 0.88;
  outline: 0;
}

.reveal-item {
  opacity: 0;
  transform: translateY(10px);
}

.response.is-visible .reveal-item {
  animation: reveal 520ms ease forwards;
}

.response.is-visible .reveal-item:nth-child(2) {
  animation-delay: 90ms;
}

@keyframes caretBlink {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .reveal-item {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .app {
    width: min(100% - 28px, 820px);
    align-items: flex-start;
    padding: 56px 0;
  }

  .chat {
    gap: 26px;
  }

  .prompt-shell {
    grid-template-columns: 1fr 36px;
  }

  .actions {
    grid-template-columns: repeat(2, auto);
    margin-bottom: -28px;
  }
}
