#rxchat,
#rxGate,
#rxRoomModal {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #d7dee8;
  --text: #1b2430;
  --muted: #5b6778;
  --accent: #2f6feb;
  --accent-text: #ffffff;
  --danger: #c0392b;
  --ok: #1f8a4c;
  font-family: "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  color: var(--text);
}

#rxchat {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 240px;
  min-height: 72vh;
  max-height: 82vh;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

#rxchat .rx-side,
#rxchat .rx-right {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 16px;
  overflow: auto;
}
#rxchat .rx-right {
  border-right: 0;
  border-left: 1px solid var(--line);
}
#rxchat .rx-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
#rxchat .rx-brand-mark {
  width: 12px;
  height: 12px;
  border-radius: 99px;
  background: var(--accent);
}
#rxchat .rx-brand span,
#rxchat .rx-side-label,
#rxchat .rx-head p,
#rxchat .rx-empty,
#rxchat .rx-meta {
  color: var(--muted);
  font-size: 13px;
}
#rxchat .rx-brand strong,
#rxchat .rx-head h1 {
  display: block;
  color: var(--text);
  font-size: 16px;
  margin: 0;
}
#rxchat .rx-side-label {
  margin: 18px 0 8px;
}

#rxchat .rx-btn,
#rxchat .rx-composer button,
#rxchat .rx-head-actions button,
#rxGate .rx-btn,
#rxRoomModal .rx-btn {
  appearance: none !important;
  border: 1px solid var(--line) !important;
  background: #fff !important;
  color: var(--text) !important;
  border-radius: 10px !important;
  padding: 10px 14px !important;
  cursor: pointer !important;
  font: inherit !important;
  text-decoration: none !important;
  display: inline-block !important;
  line-height: 1.3 !important;
}
#rxchat .rx-btn-primary,
#rxchat #rxSend,
#rxGate .rx-btn-primary,
#rxRoomModal .rx-btn-primary {
  background: var(--accent) !important;
  color: var(--accent-text) !important;
  border-color: var(--accent) !important;
  font-weight: 700 !important;
  width: 100%;
}
#rxchat #rxSend {
  width: auto;
}

#rxchat .rx-room,
#rxchat .rx-member {
  padding: 10px 8px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
}
#rxchat .rx-room:hover,
#rxchat .rx-member:hover,
#rxchat .rx-room.active {
  background: #eef3fb;
}
#rxchat .rx-room small,
#rxchat .rx-member small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
#rxchat .rx-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}
#rxchat .rx-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
#rxchat .rx-head-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
#rxchat .rx-messages {
  flex: 1;
  overflow: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#rxchat .rx-msg { max-width: 78%; }
#rxchat .rx-msg.me { align-self: flex-end; text-align: right; }
#rxchat .rx-msg .bubble {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
#rxchat .rx-msg.me .bubble {
  background: #2f6feb;
  color: #fff;
  border-color: #2f6feb;
}
#rxchat .rx-msg.system,
#rxchat .rx-msg.notice,
#rxchat .rx-msg.kick,
#rxchat .rx-msg.ban {
  align-self: center;
  text-align: center;
  max-width: 90%;
}
#rxchat .rx-msg.system .bubble,
#rxchat .rx-msg.kick .bubble,
#rxchat .rx-msg.ban .bubble {
  background: transparent;
  border: 0;
  color: var(--muted);
}
#rxchat .rx-msg.notice .bubble {
  background: #fff7dd;
  color: #7a5b00;
  border-color: #f0d789;
}
#rxchat .rx-composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
#rxchat .rx-composer input,
#rxGate input:not([type="radio"]),
#rxRoomModal input:not([type="radio"]) {
  appearance: none !important;
  flex: 1;
  width: 100% !important;
  min-height: 44px !important;
  background: #ffffff !important;
  color: #1b2430 !important;
  border: 2px solid #8fa0b5 !important;
  border-radius: 10px !important;
  padding: 10px 12px !important;
  font: inherit !important;
  box-shadow: none !important;
  opacity: 1 !important;
  caret-color: #1b2430 !important;
}
#rxchat .rx-composer input:focus,
#rxGate input:not([type="radio"]):focus,
#rxRoomModal input:not([type="radio"]):focus {
  border-color: var(--accent) !important;
  outline: 3px solid rgba(47, 111, 235, 0.2) !important;
}
#rxchat .rx-member .ops { display: none; gap: 4px; margin-top: 6px; }
#rxchat .rx-member:hover .ops { display: flex; flex-wrap: wrap; }
#rxchat .rx-member .ops button { font-size: 11px; padding: 4px 6px !important; }
#rxchat .rx-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  display: inline-block;
  margin-right: 6px;
  background: #b7c0cc;
}
#rxchat .rx-dot.on { background: var(--ok); }
#rxchat .rx-admin {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
#rxchat .rx-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--text);
}
#rxchat .rx-admin-log {
  margin-top: 10px;
  height: 280px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  font-size: 12px;
  display: none;
  color: var(--text);
}
#rxchat .rx-admin-log.on { display: block; }
#rxchat .rx-empty { margin: auto; }

#rxGate,
#rxRoomModal {
  position: fixed !important;
  inset: 0 !important;
  background: rgba(15, 23, 36, 0.55) !important;
  display: grid !important;
  place-items: center !important;
  z-index: 2147483000 !important;
}
#rxGate[hidden],
#rxRoomModal[hidden] {
  display: none !important;
}
#rxGate .rx-card,
#rxRoomModal .rx-card {
  width: min(420px, 92vw);
  background: #ffffff !important;
  color: #1b2430 !important;
  border: 1px solid #d7dee8 !important;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#rxGate .rx-card h2,
#rxRoomModal .rx-card h2 {
  margin: 0;
  color: #1b2430 !important;
  font-size: 22px;
}
#rxGate .rx-card p,
#rxRoomModal .rx-card p,
#rxGate .rx-card label,
#rxRoomModal .rx-card label {
  color: #334155 !important;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#rxGate .rx-gender {
  flex-direction: row;
  gap: 14px;
  color: #1b2430 !important;
}
#rxGate .rx-gender label {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: #1b2430 !important;
}
#rxRoomModal .rx-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
#rxRoomModal .rx-modal-actions .rx-btn-primary {
  width: auto;
}

@media (max-width: 900px) {
  #rxchat { grid-template-columns: 1fr; max-height: none; }
  #rxchat .rx-side,
  #rxchat .rx-right { display: none; }
}
