#chat-root {
  top: 155px;
  right: 34px;
  position: absolute;
  width: min(360px, calc(100vw - 32px));
  z-index: 4;
  pointer-events: none;
}

#chat-toggle,
#chat-panel form {
  pointer-events: auto;
}

#chat-panel form[hidden] { display: none; }

#chat-toggle { float: right; }

#chat-root select,
#chat-root input,
#chat-root button {
  font-family: inherit;
  background: #111d1b;
  color: #c2dfcb;
  border: 1px solid #8af0c3;
  padding: 6px;
  outline: none;
}

#chat-root :focus-visible {
  outline: 2px solid #8af0c3;
}

#chat-toggle,
#chat-panel {
  background-color: #111d1b;
  border: 1px solid #8af0c3;
  color: #c2dfcb;
}

#chat-panel:not([hidden]) {
  clear: both;
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
}

#chat-panel header {
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

#chat-log {
  max-height: 150px;
  overflow: auto;
  pointer-events: none;
  word-break: break-word;
  padding: 4px 0;
}

#chat-panel form {
  display: flex;
  gap: 4px;
}

#chat-input {
  flex: 1;
  min-width: 0;
}

@media (max-width: 700px) {
  #chat-root {
    top: 225px;
    right: 12px;
    width: min(320px, calc(100vw - 24px));
  }
}

@media (max-height: 500px) {
  #chat-root {
    top: 60px;
  }

  #chat-log {
    max-height: 70px;
  }
}
