#serverChat {
  position: absolute;
  z-index: 15;
  left: 8px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  color: #435337;
  font-family: Arial, sans-serif;
}
.server-chat-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 84px;
  height: 39px;
  padding: 0 12px;
  border: 1px solid #688448;
  border-radius: 6px;
  background: linear-gradient(#f7f4d8, #dce8b5);
  box-shadow: 0 2px 6px #24391f70;
  color: #425d31;
  font: 700 14px Georgia;
  cursor: pointer;
}
.server-chat-toggle:hover {
  background: linear-gradient(#fffde8, #e7f2c7);
}
.server-chat-toggle > span {
  font: 16px Arial;
}
#serverChatBadge {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding: 0 5px;
  border: 2px solid #fff5dc;
  border-radius: 12px;
  background: #d63e35;
  color: #fff;
  font: 700 10px Arial;
  box-shadow: 0 1px 4px #351e1e88;
}
#serverChatBadge[hidden] {
  display: none;
}
.server-chat-panel {
  display: flex;
  flex-direction: column;
  width: 360px;
  height: min(460px, 62vh);
  min-height: 220px;
  overflow: hidden;
  border: 2px solid #8d5728;
  border-radius: 15px;
  background: #f6e8c5;
  box-shadow: 0 4px 14px #15271388;
}
.server-chat-heading {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 9px;
  border-bottom: 1px solid #b67b3d;
  background: linear-gradient(#ae6e2d, #8d4e1f);
}
.server-chat-heading > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.server-chat-heading b {
  font: 700 14px Georgia;
  color: #fff6e6;
}
.server-chat-heading small {
  font: 11px Arial;
  color: #f2d9b0;
}
#serverChatClose {
  width: 26px;
  height: 26px;
  border: 1px solid #d6ae73;
  border-radius: 6px;
  background: #fff5df;
  color: #8c4b20;
  font: 20px/20px Arial;
  cursor: pointer;
}
.server-chat-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  margin: 0;
  padding: 8px;
  overflow: auto;
  overscroll-behavior: contain;
  list-style: none;
  background: #fff8e9;
  scrollbar-width: thin;
  scrollbar-color: #9aae7e transparent;
}
.server-chat-message {
  align-self: stretch;
  width: auto;
  max-width: none;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 7px 8px;
  border: 1px solid #e4bd7d;
  border-radius: 10px;
  background: #fff9ee;
  color: #473b2d;
  font: 13px/1.4 Arial;
}
.server-chat-message.mine {
  align-self: stretch;
  max-width: none;
  border-color: #d7ad6b;
  background: #f5e1b8;
}
.server-chat-message.pending {
  opacity: 0.7;
}
.server-chat-message b {
  display: block;
  margin-bottom: 2px;
  color: #8b4f20;
  font-size: 11px;
}
.server-chat-author {
  display: flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin-bottom: 4px;
}
.server-chat-name {
  flex: 0 0 auto;
  max-width: 110px;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
  color: #804618;
  font: 700 12px Arial;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.server-chat-name:hover,
.server-chat-name[aria-expanded="true"] {
  color: #a14d18;
  text-decoration: underline;
}
.server-chat-stat {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #54724b;
  font: 700 9px Arial;
}
.server-chat-stat img {
  width: 13px;
  height: 13px;
  object-fit: contain;
}
.server-chat-stat.popularity {
  color: #bd4f67;
}
.server-chat-farm {
  flex-basis: 100%;
  margin-left: 1px;
  color: #7a866e;
  font: 10px Arial;
}
.server-chat-body {
  display: inline;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.server-chat-line {
  display: flex;
  align-items: baseline;
  gap: 0;
  min-width: 0;
  color: #473b2d;
  font: 13px/1.4 Arial;
}
.server-chat-line .server-chat-name {
  max-width: 105px;
}
.server-chat-line .server-chat-body {
  flex: 1 1 auto;
}
.server-chat-message .server-chat-line time {
  display: inline;
  flex: 0 0 auto;
  margin-left: 8px;
  margin-top: 0;
  color: #8a8173;
  font: 9px Arial;
  white-space: nowrap;
}
.server-chat-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid #d8e0c8;
}
.server-chat-actions[hidden] {
  display: none;
}
.server-chat-actions > button,
.server-chat-reaction {
  min-height: 25px;
  padding: 3px 6px;
  border: 1px solid #c4d2ad;
  border-radius: 4px;
  background: #fff8e9;
  color: #4d673d;
  font: 10px Arial;
  cursor: pointer;
}
.server-chat-actions > button:hover,
.server-chat-reaction:hover,
.server-chat-reaction.selected {
  border-color: #8da86a;
  background: #e6f1d8;
}
.server-chat-reaction-picker,
.server-chat-reaction-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.server-chat-reaction-summary {
  margin-top: 4px;
}
.server-chat-reaction-summary:empty {
  display: none;
}
.server-chat-reaction {
  min-height: 21px;
  padding: 2px 5px;
}
.server-chat-message time {
  display: block;
  margin-top: 2px;
  color: #90967e;
  font-size: 9px;
  text-align: right;
}
.server-chat-empty {
  margin: auto;
  color: #7e896e;
  font: 12px Arial;
  text-align: center;
}
.server-chat-notice {
  flex: none;
  margin: 0;
  padding: 4px 7px;
  background: #f0efd9;
  color: #788266;
  font: 10px Arial;
  text-align: center;
}
.server-chat-form {
  display: flex;
  flex: none;
  gap: 5px;
  padding: 7px;
  border-top: 1px solid #d1a86d;
  background: #e7c997;
}
.server-chat-form input {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #c18b4e;
  border-radius: 9px;
  background: #fffaf0;
  color: #463b30;
  font: 12px Arial;
}
.server-chat-form button {
  min-width: 58px;
  border: 1px solid #74431c;
  border-radius: 9px;
  background: linear-gradient(#82bd3a, #57951d);
  color: #fff;
  font: 700 12px Georgia;
  text-shadow: 0 1px #617e3e;
  cursor: pointer;
}
.server-chat-form button:disabled {
  opacity: 0.6;
  cursor: wait;
}
.server-chat-notice.error {
  color: #a44336;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
#game.visiting #serverChat {
  display: none;
}
@media (max-width: 700px) {
  #serverChat {
    left: 4px;
    bottom: max(8px, env(safe-area-inset-bottom));
  }
  .server-chat-panel {
    width: min(360px, calc(100vw - 16px));
    height: min(440px, 62vh);
  }
  .server-chat-toggle {
    height: 36px;
    min-width: 76px;
  }
}
