.game-play-area.has-online-chat {
  max-width: 1540px;
}

.online-chat-panel {
  width: 270px;
  min-width: 245px;
  height: min(660px, calc(100vh - 100px));
  flex: 0 0 270px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(30, 16, 9, 0.96);
  border: 2px solid var(--brass);
  border-radius: 14px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
  color: #f5eedc;
}

.online-chat-panel[hidden],
.online-chat-toggle[hidden],
.online-chat-unread[hidden] {
  display: none !important;
}

.online-chat-header {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(197, 155, 39, 0.45);
}

.online-chat-header h2 {
  color: #f7e7ce;
  font-family: var(--font-royal);
  font-size: 15px;
}

.online-chat-close {
  display: none;
  border: 0;
  background: transparent;
  color: #f5eedc;
  font-size: 27px;
  line-height: 1;
  cursor: pointer;
}

.online-chat-messages {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  padding: 12px;
  overscroll-behavior: contain;
}

.online-chat-message {
  max-width: 88%;
  align-self: flex-start;
}

.online-chat-message.is-mine {
  align-self: flex-end;
  text-align: right;
}

.online-chat-sender {
  margin: 0 4px 3px;
  color: #d3b771;
  font-size: 10px;
  font-weight: 700;
}

.online-chat-text {
  display: inline-block;
  padding: 8px 10px;
  border: 1px solid rgba(197, 155, 39, 0.35);
  border-radius: 12px 12px 12px 3px;
  background: rgba(90, 55, 27, 0.8);
  color: #fff8e8;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-align: left;
  user-select: text;
  -webkit-user-select: text;
}

.online-chat-message.is-mine .online-chat-text {
  border-radius: 12px 12px 3px 12px;
  background: linear-gradient(135deg, #79521e, #93621f);
}

.online-chat-composer {
  padding: 9px;
  border-top: 1px solid rgba(197, 155, 39, 0.35);
}

.online-chat-reactions {
  display: flex;
  gap: 7px;
  margin-bottom: 8px;
}

.online-chat-emoji {
  flex: 1;
  min-width: 36px;
  min-height: 34px;
  border: 1px solid rgba(197, 155, 39, 0.4);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font-size: 17px;
  cursor: pointer;
}

.online-chat-input-row {
  display: flex;
  gap: 7px;
}

.online-chat-input-row input {
  width: 0;
  min-width: 0;
  flex: 1;
  padding: 9px;
  border: 1px solid #6b4324;
  border-radius: 8px;
  outline: none;
  background: rgba(15, 8, 4, 0.8);
  color: #fff8e8;
  font: inherit;
  font-size: 13px;
  user-select: text;
  -webkit-user-select: text;
}

.online-chat-input-row button {
  padding: 0 12px;
  border: 1px solid #66bb6a;
  border-radius: 8px;
  background: linear-gradient(135deg, #2e7d32, #1b5e20);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.online-chat-toggle {
  display: none;
}

@media (max-width: 1024px) and (min-width: 769px) {
  .online-chat-panel {
    width: 100%;
    min-width: 0;
    height: 360px;
    flex-basis: auto;
  }
}
