html,
body {
  min-height: 100%;
  margin: 0;
  background: #f7f9f7;
}

.login-back-button {
  position: fixed;
  z-index: 10;
  top: max(0.75rem, env(safe-area-inset-top, 0px));
  left: max(0.75rem, calc((100vw - 760px) / 2));
}

.login-back-button a {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 1px solid #e6ece8;
  border-radius: 50%;
  background: #ffffff;
  color: #348157;
  box-shadow: 0 0.2rem 0.7rem rgba(23, 53, 43, 0.08);
}

.chat-container {
  display: flex;
  width: min(100%, 760px);
  height: 100vh;
  height: 100dvh;
  height: var(--chat-viewport-height, 100dvh);
  flex-direction: column;
  margin: 0 auto;
  padding: calc(4rem + env(safe-area-inset-top, 0px)) 1rem 0;
  background: #ffffff;
  box-shadow: 0 0 2rem rgba(23, 53, 43, 0.05);
}

.chat-box {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 0.75rem 0.25rem 1rem;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  touch-action: pan-y;
}

.chat-box::-webkit-scrollbar {
  display: none;
}

.chat-message {
  display: flex;
  width: fit-content;
  max-width: min(88%, 34rem);
  margin: 0.35rem 0;
  padding: 0.75rem 0.9rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.chat-message .message-content {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.chat-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bot-message-copy {
  display: grid;
  min-width: 0;
  gap: 0.2rem;
}

.assistant-name {
  color: #286b50;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
}

.assistant-name span {
  margin-left: 0.2rem;
  color: #829087;
  font-size: 0.66rem;
  font-weight: 500;
}

.chat-message.bot {
  align-self: flex-start;
  border: 1px solid #e7ece8;
  border-bottom-left-radius: 0.3rem;
  background: #f3f6f4;
  color: #30443a;
}

.chat-message.user {
  align-self: flex-end;
  border-bottom-right-radius: 0.3rem;
  background: #348157;
  color: #ffffff;
}

.chat-icon {
  width: 1.65rem;
  height: 1.65rem;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
}

.chat-input-container {
  display: grid;
  gap: 0.7rem;
  padding: 0.85rem 0 max(1rem, env(safe-area-inset-bottom));
  border-top: 1px solid #edf0ee;
  background: #ffffff;
}

.chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 0.35rem;
  border: 1px solid #dfe7e1;
  border-radius: 999px;
  background: #ffffff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.chat-input-wrap:focus-within {
  border-color: #7eae8d;
  box-shadow: 0 0 0 0.2rem rgba(52, 129, 87, 0.1);
}

.chat-input {
  width: 100%;
  min-width: 0;
  min-height: 2.65rem;
  padding: 0.55rem 0.8rem;
  border: 0;
  outline: 0;
  background: transparent;
  color: #273b30;
  font: inherit;
  font-size: 0.9rem;
}

.chat-input::placeholder {
  color: #8a9690;
}

.chat-input:disabled {
  color: #8a9690;
}

.chat-send-button {
  display: grid;
  width: 2.65rem;
  height: 2.65rem;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #348157;
  color: #ffffff;
  font-size: 1.1rem;
  transition: background-color 150ms ease;
}

.chat-send-button:hover:not(:disabled) {
  background: #286b45;
}

.chat-send-button:disabled {
  background: #bdc9c0;
}

.chat-choice-button {
  min-height: 2.6rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid #cfe0d4;
  border-radius: 999px;
  background: #f4f8f5;
  color: #2c6743;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.chat-choice-button:hover,
.chat-choice-button:focus-visible {
  border-color: #74a986;
  background: #e8f3eb;
}

.chat-choice-button.selected {
  border-color: #348157;
  background: #e5f1e8;
  color: #245c3b;
}

.chat-choice-button:disabled {
  cursor: default;
}

.chat-choice-button:focus-visible,
.chat-send-button:focus-visible,
.login-back-button a:focus-visible {
  outline: 3px solid rgba(52, 129, 87, 0.25);
  outline-offset: 2px;
}

@media (max-width: 575.98px) {
  .chat-container {
    padding: calc(3.75rem + env(safe-area-inset-top, 0px)) 0.75rem 0;
  }

  .chat-box {
    padding-right: 0;
    padding-left: 0;
  }

  .chat-message {
    max-width: 92%;
    font-size: 0.86rem;
  }

  .chat-input-container {
    padding-top: 0.7rem;
  }

  .chat-choice-list {
    gap: 0.4rem;
  }

  .chat-choice-button {
    min-height: 2.45rem;
    padding: 0.55rem 0.8rem;
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-box {
    scroll-behavior: auto;
  }

  .chat-input-wrap,
  .chat-send-button,
  .chat-choice-button {
    transition: none;
  }
}
