.support-chat-entry, .support-chat-shortcut {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
}
.support-chat-entry {
  color: var(--muted);
  border: 0;
  padding: .4rem 0;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: .22em;
}
.support-chat-shortcut {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 7;
  min-height: 2.65rem;
  padding: .42rem .8rem;
  border: 1px solid var(--line);
  border-radius: .48rem;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 3px 12px #0002;
}
.support-chat-shortcut svg { color: var(--accent); }
.support-chat-shortcut:hover { border-color: var(--accent); }
.support-chat {
  position: fixed;
  inset: auto max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) auto;
  width: min(27rem, calc(100vw - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 12px 36px #0003;
  line-height: 1.45;
}
.support-chat::backdrop { background: #0004; }
.support-chat-shell {
  max-height: inherit;
  height: min(38rem, calc(100dvh - 2rem));
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: .7rem;
  overflow: auto;
  overscroll-behavior: contain;
}
.support-chat-head, .support-chat-tools, .support-chat-start > div, .support-chat-sources {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem .8rem;
}
.support-chat-head { justify-content: space-between; gap: .4rem; }
.support-chat-head h2 { font-size: 1.25rem; line-height: 1.2; letter-spacing: -.025em; }
.support-chat-head h2:focus { outline: 0; }
.support-chat button, .support-chat a { touch-action: manipulation; }
.support-chat-close {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: .3rem;
  font-size: 1.45rem;
  line-height: 1;
}
.support-chat-private { font-size: .77rem; line-height: 1.5; color: var(--muted); }
.support-chat-start, .support-chat-state, .support-chat-confirm { padding: .6rem .75rem; border-left: 2px solid var(--accent); background: var(--surface); }
.support-chat-start p, .support-chat-state strong, .support-chat-confirm p { font-size: .875rem; }
.support-chat-state span { display: block; margin-top: .18rem; font-size: .72rem; color: var(--muted); overflow-wrap: anywhere; }
.support-chat-start button, .support-chat-tools button, .support-chat-tools a, .support-chat-confirm button, .support-chat-notice button, .support-chat-error button, .support-chat-unseen {
  appearance: none;
  background: transparent;
  border: 0;
  padding: .32rem 0;
  font-size: .8125rem;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: .2em;
}
.support-chat-start button, .support-chat-tools button, .support-chat-tools a { min-height: 2rem; }
.support-chat button:disabled { color: var(--muted); cursor: default; }
.support-chat-log {
  min-height: 3.5rem;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--muted) transparent;
  margin: 0;
  padding: 0 .25rem 0 0;
  list-style: none;
}
.support-chat-log:empty { min-height: 0; }
.support-chat-log li + li { border-top: 1px solid var(--line); padding-top: .45rem; margin-top: .55rem; }
.support-chat-by { font-size: .72rem; color: var(--muted); font-weight: 650; }
.support-chat-question, .support-chat-reply { margin: .15rem 0 .5rem; font-size: .92rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.support-chat-question { color: var(--ink); }
.support-chat-sources a { font-size: .8rem; color: var(--accent); text-underline-offset: .2em; }
.support-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .45rem; }
.support-chat-form textarea {
  width: 100%; min-width: 0; resize: none; border: 1px solid var(--line); border-radius: .3rem;
  padding: .48rem .55rem; font-size: .93rem; color: var(--ink); background: var(--surface);
}
.support-chat .btn { min-height: 2.55rem; padding: .35rem .8rem; border-radius: .3rem; }
.support-chat .btn:disabled { color: var(--on-accent); }
.support-chat-form .support-chat-error { grid-column: 1 / -1; }
.support-chat-tools { border-top: 1px solid var(--line); justify-content: space-between; gap: .2rem .65rem; }
.support-chat-error, .support-chat-notice { font-size: .82rem; }
.support-chat-error { color: var(--danger); }
.support-chat-confirm button + button { margin-left: 1rem; }
.support-chat-unseen { align-self: center; }
.support-chat-sr { position: absolute; width: 1px; height: 1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 38rem) {
  .support-chat { inset: auto .5rem max(.5rem, env(safe-area-inset-bottom)) auto; width: calc(100% - 1rem); max-height: calc(100dvh - 1rem); }
  .support-chat-shell { height: min(37rem, calc(100dvh - 1rem)); padding: .72rem; gap: .45rem; }
  .support-chat-form textarea { font-size: 1rem; }
  .support-chat-shortcut { right: .65rem; bottom: max(.65rem, env(safe-area-inset-bottom)); }
}
