.hero-footer {
  position: absolute;
  left: 50%;
  bottom: 20px;
  z-index: 5;
  width: min(1600px, calc(100% - 120px));
  transform: translateX(-50%);
  opacity: 0;
  transition:
    opacity 1500ms ease 1320ms,
    transform 1700ms cubic-bezier(0.22, 0.76, 0.2, 1) 1320ms;
}

body.is-ready .hero-footer {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

body.is-instant .hero-footer {
  transition: none;
}

.chat-shell {
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(20, 25, 25, 0.9), rgba(16, 20, 21, 0.94)),
    radial-gradient(circle at top, rgba(184, 155, 98, 0.04), transparent 28%);
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 230, 0.03),
    0 16px 30px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
}

.chat-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid rgba(196, 179, 141, 0.16);
  border-radius: 12px;
  background: rgba(10, 15, 16, 0.88);
  color: rgba(240, 229, 207, 0.92);
  font: inherit;
  line-height: 48px;
  outline: none;
}

.chat-input::placeholder {
  color: rgba(234, 223, 199, 0.34);
}

.chat-input:focus {
  border-color: rgba(184, 155, 98, 0.38);
  box-shadow: 0 0 0 3px rgba(184, 155, 98, 0.08);
}

.chat-submit {
  display: grid;
  place-items: center;
  min-width: 56px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(196, 179, 141, 0.16);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(184, 155, 98, 0.18), rgba(184, 155, 98, 0.1)),
    rgba(21, 26, 26, 0.92);
  color: #f0e5cf;
  font-family: "PT Mono", monospace;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 180ms ease,
    transform 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.chat-submit-icon {
  display: inline-grid;
  place-items: center;
  grid-area: 1 / 1;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.chat-submit-arrow {
  line-height: 1;
  transform: translateX(1px);
}

.chat-submit-stop {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: currentColor;
  box-shadow:
    0 0 0 1px rgba(240, 229, 207, 0.08),
    0 0 18px rgba(240, 229, 207, 0.08);
  opacity: 0;
  transform: scale(0.72);
}

.chat-submit.is-busy {
  border-color: rgba(196, 179, 141, 0.28);
  background:
    linear-gradient(180deg, rgba(143, 72, 54, 0.26), rgba(104, 48, 34, 0.18)),
    rgba(25, 21, 19, 0.94);
  box-shadow:
    inset 0 1px 0 rgba(255, 248, 230, 0.03),
    0 0 0 1px rgba(143, 72, 54, 0.08);
}

.chat-submit.is-busy .chat-submit-arrow {
  opacity: 0;
  transform: translateX(6px);
}

.chat-submit.is-busy .chat-submit-stop {
  opacity: 1;
  transform: scale(1);
}

.chat-submit:hover:not(:disabled) {
  border-color: rgba(196, 179, 141, 0.28);
  transform: translateY(-1px);
}

.chat-submit:disabled,
.chat-input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.speech-feed {
  position: fixed;
  right: clamp(720px, calc(22vw + 292px), 960px);
  top: clamp(38px, calc(24vh - 130px), 112px);
  z-index: 4;
  display: grid;
  align-content: end;
  justify-items: end;
  gap: 10px;
  width: clamp(280px, 24vw, 340px);
  min-height: 220px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 1200ms ease 1200ms,
    transform 1600ms cubic-bezier(0.22, 0.76, 0.2, 1) 1200ms;
}

body.is-ready .speech-feed {
  opacity: 1;
  transform: translateY(0);
}

body.is-instant .speech-feed {
  transition: none;
}

.speech-entry {
  position: relative;
  display: flex;
  justify-content: flex-end;
  width: 100%;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  animation: speech-enter 320ms cubic-bezier(0.22, 0.76, 0.2, 1) forwards;
}

.speech-entry::after {
  content: "";
  position: absolute;
  right: -46px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border: 1px solid rgba(196, 179, 141, 0.14);
  border-radius: 999px;
  background: rgba(230, 216, 188, 0.9);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
  pointer-events: none;
}

.speech-bubble {
  position: relative;
  max-width: 100%;
  padding: 14px 40px 15px 16px;
  border: 1px solid rgba(196, 179, 141, 0.18);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(241, 231, 210, 0.96), rgba(224, 210, 181, 0.9));
  color: #30261a;
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-family: "PT Serif", Georgia, serif;
  font-size: 0.95rem;
  line-height: 1.48;
  white-space: pre-wrap;
  text-wrap: pretty;
  pointer-events: auto;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: 22px;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(196, 179, 141, 0.18);
  border-radius: 999px;
  background: rgba(230, 216, 188, 0.94);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.speech-bubble::before {
  content: "";
  position: absolute;
  right: -32px;
  bottom: 10px;
  width: 11px;
  height: 11px;
  border: 1px solid rgba(196, 179, 141, 0.16);
  border-radius: 999px;
  background: rgba(230, 216, 188, 0.92);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

.speech-text {
  position: relative;
  z-index: 1;
}

.speech-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(48, 38, 26, 0.08);
  color: rgba(48, 38, 26, 0.78);
  font-family: "PT Mono", monospace;
  font-size: 0.95rem;
  line-height: 22px;
  text-align: center;
  cursor: pointer;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.speech-close:hover {
  background: rgba(48, 38, 26, 0.16);
  color: rgba(48, 38, 26, 1);
  transform: scale(1.05);
}

.speech-entry.is-pending .speech-bubble {
  color: rgba(48, 38, 26, 0.72);
  font-style: italic;
}

@keyframes speech-enter {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.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;
}

@media (max-width: 900px) {
  .speech-feed {
    position: absolute;
    top: 17%;
    right: 8%;
    justify-items: end;
    width: min(280px, 58vw);
    gap: 8px;
  }

  .speech-entry {
    justify-content: flex-end;
  }

  .speech-entry::after {
    right: 4px;
    bottom: -30px;
  }

  .speech-bubble {
    padding: 12px 14px;
    font-size: 0.9rem;
  }

  .speech-bubble::before {
    right: 10px;
    bottom: -20px;
  }

  .speech-bubble::after {
    right: 24px;
    bottom: -8px;
  }

  .hero-footer {
    bottom: 14px;
    width: min(100%, 640px);
  }

  .chat-form {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .chat-input {
    height: 46px;
    line-height: 46px;
  }

  .chat-submit {
    width: 100%;
  }
}
