.help-chat {
  --help-chat-edge: clamp(.75rem, 3vw, 1.5rem);
  --help-chat-right: max(var(--help-chat-edge), env(safe-area-inset-right));
  --help-chat-bottom: max(var(--help-chat-edge), env(safe-area-inset-bottom));
}

.help-chat__launcher {
  position: fixed;
  right: var(--help-chat-right);
  bottom: var(--help-chat-bottom);
  z-index: 2;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: .6rem 1.05rem .6rem .75rem;
  background: var(--blue);
  color: var(--white);
  box-shadow: 0 4px 18px #16233833;
  font-weight: 650;
  min-height: 46px;
}

.help-chat__launcher:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}

.help-chat__launcher:hover,
.help-chat__form button:hover {
  background: var(--blue-deep);
}

.help-chat__mark {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: .85rem;
  line-height: 1;
}

.help-chat__panel {
  position: fixed;
  inset: auto var(--help-chat-right) calc(var(--help-chat-bottom) + var(--help-chat-covered-bottom, 0px)) auto;
  margin: 0;
  padding: 0;
  width: min(26rem, calc(100% - var(--help-chat-right) - max(var(--help-chat-edge), env(safe-area-inset-left))));
  max-width: none;
  height: min(36rem, calc(100vh - var(--help-chat-bottom) - var(--help-chat-edge)));
  height: min(36rem, calc(var(--help-chat-viewport-height, 100dvh) - var(--help-chat-bottom) - max(var(--help-chat-edge), env(safe-area-inset-top))));
  max-height: none;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 16px 52px #152b4a3d;
  overflow: auto;
}

.help-chat__panel[open] {
  display: flex;
  flex-direction: column;
}

.help-chat__panel::backdrop {
  background: #12233b55;
}

.help-chat__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .6rem;
  padding: .45rem .9rem .45rem 1rem;
  background: var(--blue-deep);
  color: var(--white);
}

.help-chat__header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.help-chat__close,
.help-chat__topic-list button,
.help-chat__form button {
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 650;
}

.help-chat__close {
  min-height: 44px;
  padding: .35rem .6rem;
  background: transparent;
  color: inherit;
  font-size: .875rem;
}

.help-chat__close:hover {
  background: #ffffff26;
}

.help-chat__close:focus-visible {
  outline-color: #c8d9ff;
}

.help-chat__topics {
  max-height: 13rem;
  padding: .35rem .9rem .7rem;
  border-bottom: 1px solid var(--line);
  overflow: auto;
}

.help-chat__topics summary {
  padding: .4rem .1rem;
  font-size: .85rem;
  font-weight: 650;
  cursor: pointer;
}

.help-chat__topic-list {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  padding: .25rem .1rem;
}

.help-chat__topic-list button {
  min-height: 33px;
  padding: .25rem .6rem;
  border-color: var(--line);
  background: var(--white);
  color: var(--blue-deep);
  text-align: left;
  font-size: .8rem;
}

.help-chat__topic-list button:hover {
  background: var(--canvas);
}

.help-chat__log {
  position: relative;
  flex: 1;
  min-height: 5rem;
  padding: .85rem 1rem;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--canvas);
  font-size: .9rem;
  line-height: 1.5;
}

.help-chat__log:focus-visible {
  outline-offset: -3px;
}

.help-chat__turn {
  display: grid;
  gap: .45rem;
  padding: .6rem 0;
}

.help-chat__question,
.help-chat__reply {
  width: fit-content;
  max-width: 100%;
  padding: .55rem .75rem;
  margin: 0;
  border-radius: 10px;
  overflow-wrap: anywhere;
}

.help-chat__question {
  justify-self: end;
  max-width: 90%;
  background: var(--blue-deep);
  color: var(--white);
}

.help-chat__reply {
  border: 1px solid var(--line);
  background: var(--white);
}

.help-chat__reply p {
  margin: 0 0 .5rem;
}

.help-chat__reply p:last-child {
  margin: 0;
}

.help-chat__reply a {
  font-weight: 650;
}

.help-chat__form {
  display: flex;
  align-items: stretch;
  gap: .5rem;
  padding: .7rem .9rem;
  border-top: 1px solid var(--line);
}

.help-chat__form input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: .45rem .6rem;
  border: 1px solid #8799b3;
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-size: 1rem;
}

.help-chat__form button {
  padding: .45rem .8rem;
  background: var(--blue);
  color: var(--white);
  font-size: .875rem;
}

.help-chat__sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
