#room-chat-open, #room-chat-dialog button {
  background: #30362c;
  color: var(--cream);
  border: 1px solid #948a68;
  border-radius: 4px;
  font: 700 13px/1.2 var(--mono);
  padding: 7px 10px;
}
#room-chat-open { position: relative; align-self: stretch; background: #252b21e8; }
#room-chat-unread { color: var(--gold); margin-left: 5px; }
#room-chat-open kbd { padding: 0 3px; border: 1px solid #8f8e76; border-radius: 2px; font: 10px/1.1 var(--mono); }
@media (pointer: coarse) { #room-chat-open kbd { display: none; } }
#room-chat-dialog {
  width: min(420px, calc(100vw - 24px));
  max-height: min(520px, var(--chat-height, 88dvh));
  max-width: none;
  padding: 15px;
  border: 2px solid #a99b72;
  border-radius: 7px;
  background: #262c24;
  color: var(--cream);
  box-shadow: 0 14px 54px #10130ed6;
  overflow: auto;
  overscroll-behavior: contain;
  font: 15px/1.4 var(--sans);
}
#room-chat-dialog[open] { display: flex; flex-direction: column; gap: 10px; }
#room-chat-dialog::backdrop { background: #161a1363; }
#room-chat-dialog header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
#room-chat-dialog h2 { margin: 0; color: var(--gold); font: 700 19px/1.2 var(--mono); }
#room-chat-dialog p { margin: 2px 0 0; }
#room-chat-dialog header p, #room-chat-dialog small { font-size: 12px; color: #e0d9be; }
.room-chat-history { flex: 1 1 auto; height: clamp(72px, 27vh, 220px); min-height: 38px; overflow: auto; border-block: 1px solid #5c604e; padding: 7px 2px; overscroll-behavior: contain; touch-action: pan-y; }
#room-chat-log { list-style: none; margin: 0; padding: 0; }
#room-chat-log li { padding: 3px 0; overflow-wrap: anywhere; }
#room-chat-log b { color: #e9bf6e; margin-right: 6px; }
#room-chat-log cite { color: #b8d6be; margin-left: 5px; white-space: normal; }
#room-chat-form { display: flex; align-items: stretch; gap: 6px; }
#room-chat-input { flex: 1; min-width: 0; background: #f5efd9; color: #24291e; border: 1px solid #a5a083; border-radius: 3px; padding: 8px; font: 16px/1.2 var(--sans); user-select: text; -webkit-user-select: text; touch-action: manipulation; }
#room-chat-dialog #room-chat-send { background: #f0c766; color: #26271e; border-color: #f4d691; }
#room-chat-dialog button:disabled { opacity: .65; }
#room-chat-status { color: #ffdb98; font-size: 13px; }
@media (max-height: 470px) {
  #room-chat-dialog { padding: 10px 12px; }
  #room-chat-dialog[open] { gap: 5px; }
  #room-chat-open { font-size: 11px; padding: 4px 7px; }
}
