.medired-public-help,
.medired-public-help * {
  box-sizing: border-box;
  letter-spacing: 0;
}

.medired-public-help {
  position: fixed;
  right: max(28px, calc(env(safe-area-inset-right) + 18px));
  bottom: max(28px, calc(env(safe-area-inset-bottom) + 18px));
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.medired-public-chat-toggle {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: 9px;
  padding: 8px 16px 8px 9px;
  border: 1px solid rgba(15, 34, 78, .14);
  border-radius: 24px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .18);
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none !important;
  cursor: pointer;
  transition: box-shadow .18s ease, transform .18s ease;
}

.medired-public-chat-toggle {
  background: #ffffff;
  color: #102c67;
}

.medired-public-chat-toggle:hover {
  box-shadow: 0 12px 30px rgba(15, 23, 42, .22);
  transform: translateY(-2px);
}

.medired-public-chat-toggle:focus-visible,
.medired-public-chat button:focus-visible,
.medired-public-chat input:focus-visible,
.medired-public-chat a:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .4);
  outline-offset: 2px;
}

.medired-public-chat-toggle__mark {
  display: grid;
  width: 32px;
  height: 32px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 750;
}

.medired-public-chat-toggle__mark {
  background: #2856e6;
  color: #fff;
}

.medired-public-chat {
  position: absolute;
  right: 0;
  bottom: 58px;
  width: min(380px, calc(100vw - 32px));
  max-height: min(650px, calc(100vh - 110px));
  overflow: hidden;
  border: 1px solid #dce3ee;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
  color: #172033;
}

.medired-public-chat[hidden] {
  display: none;
}

.medired-public-chat__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 74px;
  padding: 15px 18px;
  border-bottom: 1px solid #e7ebf2;
  background: #102c67;
  color: #fff;
}

.medired-public-chat__header h2 {
  margin: 2px 0 0;
  color: inherit;
  font-size: 18px;
  line-height: 1.25;
}

.medired-public-chat__eyebrow {
  display: block;
  color: #b9cbf5;
  font-size: 10px;
  font-weight: 700;
}

.medired-public-chat__close {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}

.medired-public-chat__messages {
  display: flex;
  min-height: 190px;
  max-height: 330px;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 16px;
  background: #f6f8fb;
}

.medired-public-chat__message {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.medired-public-chat__message--assistant {
  align-self: flex-start;
  border: 1px solid #e2e7ef;
  background: #fff;
  color: #263247;
}

.medired-public-chat__message--user {
  align-self: flex-end;
  background: #2856e6;
  color: #fff;
}

.medired-public-chat__message--pending {
  min-width: 42px;
  color: #6b7890;
  font-size: 18px;
  letter-spacing: 3px;
  animation: medired-public-chat-pending 1s ease-in-out infinite;
}

@keyframes medired-public-chat-pending {
  0%,
  100% {
    opacity: .35;
  }

  50% {
    opacity: 1;
  }
}

.medired-public-chat__suggestions {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 11px 14px 3px;
  background: #fff;
}

.medired-public-chat__suggestions button {
  flex: none;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #cfd8e7;
  border-radius: 16px;
  background: #fff;
  color: #26416f;
  font-size: 12px;
  cursor: pointer;
}

.medired-public-chat__form {
  display: grid;
  grid-template-columns: 1fr 58px;
  gap: 8px;
  padding: 10px 14px;
}

.medired-public-chat__form input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #cbd5e3;
  border-radius: 6px;
  color: #172033;
  font: inherit;
  font-size: 14px;
}

.medired-public-chat__form button {
  border: 0;
  border-radius: 6px;
  background: #102c67;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.medired-public-chat__form button:disabled {
  cursor: wait;
  opacity: .55;
}

.medired-public-chat__kakao {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0 14px 14px;
  padding: 10px;
  border-radius: 6px;
  background: #fee500;
  color: #191919 !important;
  font-size: 13px;
  font-weight: 650;
  text-align: center;
  text-decoration: none !important;
}

.medired-public-chat__kakao-mark {
  font-size: 16px;
  line-height: 1;
}

.medired-public-chat .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .medired-public-help {
    right: max(14px, calc(env(safe-area-inset-right) + 10px));
    bottom: max(14px, calc(env(safe-area-inset-bottom) + 10px));
    gap: 7px;
  }

  .medired-public-chat-toggle {
    min-height: 40px;
    padding: 5px 10px 5px 6px;
    font-size: 12px;
  }

  .medired-public-chat-toggle__mark {
    width: 28px;
    height: 28px;
  }

  .medired-public-chat {
    position: fixed;
    right: 12px;
    bottom: 54px;
    width: calc(100vw - 24px);
    max-height: calc(100vh - 88px);
  }

  .medired-public-chat__messages {
    max-height: calc(100vh - 340px);
  }
}

@media (max-width: 430px) {
  .medired-public-chat-toggle > span:last-child {
    display: none;
  }

  .medired-public-chat-toggle {
    padding-right: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .medired-public-chat-toggle,
  .medired-public-chat__message--pending {
    transition: none;
    animation: none;
  }
}
