:root {
  color: #000;
  background: #fff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: #fff;
}

#home {
  position: relative;
  display: block;
  width: 100vw;
  height: 100vh;
  background: #fff;
}

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

.chat-log {
  height: 100vh;
  overflow-y: auto;
  padding: 32px max(18px, calc((100vw - 760px) / 2)) 136px;
  scroll-behavior: smooth;
}

.chat-log::before {
  content: "";
  display: block;
  height: var(--chat-spacer, 0px);
}

.message {
  display: flex;
  width: 100%;
  max-width: 760px;
  margin: 0 auto 28px;
  font-size: 15px;
  line-height: 1.62;
}

.message-user {
  justify-content: flex-end;
}

.message-assistant {
  justify-content: flex-start;
}

.message-content {
  min-width: 0;
  max-width: min(680px, 88%);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-user .message-content {
  padding: 9px 13px;
  color: #fff;
  background: #000;
  border-radius: 16px 16px 4px 16px;
}

.message-assistant .message-content {
  padding: 2px 0;
  color: #111;
}

.message-assistant.is-typing .message-content::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 2px;
  border-right: 2px solid #111;
  transform: translateY(2px);
  animation: caret-blink 0.8s steps(1) infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

.beta-notice {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 1;
  width: min(760px, calc(100vw - 32px));
  color: rgba(0, 0, 0, 0.48);
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.02em;
  transform: translateX(-50%);
  pointer-events: none;
}

.chat-form {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 1;
  display: grid;
  grid-template-columns: 25px auto minmax(0, 1fr) auto;
  grid-template-areas:
    "geometry attach input submit"
    "status status status status";
  align-items: end;
  gap: 8px;
  width: min(760px, calc(100vw - 32px));
  padding: 10px;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 10px;
  transform: translateX(-50%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.geometry-cursor {
  grid-area: geometry;
  align-self: center;
  display: grid;
  place-items: center;
  width: 25px;
  height: 28px;
  color: rgba(0, 102, 255, 0.72);
  pointer-events: none;
}

.geometry-cursor svg {
  width: 24px;
  height: 24px;
  overflow: visible;
  animation: tetra-breathe 5.6s ease-in-out infinite;
}

.geometry-cursor path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.chat-form:focus-within .geometry-cursor {
  color: rgba(0, 102, 255, 0.88);
}

.chat-form:focus-within .geometry-cursor svg,
.chat-form.is-thinking .geometry-cursor svg {
  animation: tetra-turn 7.5s linear infinite, tetra-breathe 2.8s ease-in-out infinite;
}

.chat-form.is-thinking .geometry-cursor {
  color: rgba(0, 102, 255, 1);
}

.chat-form.is-slow {
  border-color: rgba(220, 38, 38, 0.42);
  box-shadow: 0 10px 30px rgba(220, 38, 38, 0.08);
}

.chat-form.is-slow .geometry-cursor {
  color: rgba(220, 38, 38, 1);
}

.chat-form.is-slow .geometry-cursor svg {
  animation: tetra-turn 1.35s linear infinite, tetra-breathe 1.1s ease-in-out infinite;
}

.chat-form.is-slow #chat-input::placeholder {
  color: rgba(220, 38, 38, 0.78);
}

.chat-attach {
  grid-area: attach;
  align-self: center;
  display: grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  color: rgba(0, 0, 0, 0.62);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.chat-attach:hover,
.chat-attach:focus-visible,
.chat-form.has-attachment .chat-attach {
  color: #000;
  border-color: rgba(0, 0, 0, 0.18);
  outline: 0;
}

.chat-form.has-attachment .chat-attach {
  background: rgba(0, 102, 255, 0.08);
  border-color: rgba(0, 102, 255, 0.28);
}

.attachment-status {
  grid-area: status;
  display: none;
  min-width: 0;
  padding: 2px 4px 0 41px;
  color: rgba(0, 102, 255, 0.9);
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-form.has-attachment .attachment-status {
  display: block;
}

@keyframes tetra-turn {
  to {
    transform: rotate(360deg);
  }
}

@keyframes tetra-breathe {
  0%,
  100% {
    opacity: 0.42;
    scale: 0.94;
  }

  50% {
    opacity: 0.74;
    scale: 1.06;
  }
}

#chat-input {
  grid-area: input;
  width: 100%;
  max-height: 180px;
  min-height: 28px;
  padding: 5px 4px;
  resize: none;
  overflow-y: auto;
  color: #000;
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
  line-height: 1.45;
}

#chat-input::placeholder {
  color: #8a8a8a;
}

#chat-submit {
  grid-area: submit;
  align-self: end;
  display: grid;
  place-items: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  color: #fff;
  background: #000;
  border: 0;
  border-radius: 50%;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

#chat-submit:disabled {
  cursor: default;
  opacity: 0.35;
}

@media (max-width: 640px) {
  .chat-log {
    padding: 28px 16px 118px;
  }

  .message {
    margin-bottom: 24px;
  }

  .beta-notice {
    bottom: 78px;
    width: calc(100vw - 24px);
  }

  .chat-form {
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}
