.monitor-chat {
  --chat-muted: #869bb5;
  position: fixed; right: 16px; bottom: 16px;
  width: min(408px, calc(100vw - 32px)); height: min(660px, calc(100dvh - 88px));
  z-index: 100; display: flex; flex-direction: column; overflow: hidden;
  color: #e8eff9; background: #0d1829; border: 1px solid #304158; border-radius: 16px;
  box-shadow: 0 24px 80px #02060ec0, 0 0 0 1px #ffffff04 inset;
  font: 13px/1.45 system-ui, sans-serif; color-scheme: dark;
}
.chat-head {
  display: flex; align-items: center; gap: 10px; padding: 13px 14px;
  background: linear-gradient(115deg, #162e43, #132238 65%, #101d30);
  border-bottom: 1px solid #ffffff0b;
}
.chat-avatar {
  flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid #72d5d33b; border-radius: 11px; color: #a0ebe5;
  background: linear-gradient(145deg, #247d814a, #245a8d40); font-size: 13px; font-weight: 700;
}
.chat-identity { flex: 1; min-width: 0; }
.chat-head h2 { margin: 0 0 3px; font-size: 14px; line-height: 1.3; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-connection { display: flex; align-items: center; gap: 5px; color: var(--chat-muted); font-size: 10px; }
.chat-connection i { width: 5px; height: 5px; background: #8793a4; border-radius: 50%; }
.monitor-chat[data-ready="true"] .chat-connection { color: #78d8b5; }
.monitor-chat[data-ready="true"] .chat-connection i { background: #5ed6a6; box-shadow: 0 0 8px #5ed6a655; }
.chat-live-badge { font-size: 9px; letter-spacing: .12em; font-weight: 700; color: #83a4c4; border: 1px solid #ffffff12; padding: 3px 6px; border-radius: 5px; }
.monitor-chat button, .monitor-chat select, .monitor-chat textarea { font: inherit; color: inherit; border: 1px solid #30435c; background: #15253b; border-radius: 8px; padding: 7px 9px; }
.monitor-chat button { cursor: pointer; transition: background .15s, border-color .15s; }
.monitor-chat button:hover:enabled { background: #203d58; border-color: #4d7393; }
.monitor-chat button:disabled { opacity: .4; cursor: default; }
.monitor-chat :is(button, select, textarea):focus-visible { outline: 2px solid #60bbb7; outline-offset: 2px; }
.chat-head button { width: 30px; height: 30px; padding: 0; color: #9ab0c7; border-color: transparent; background: transparent; font-size: 21px; line-height: 1; }
.chat-filter { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid #ffffff07; }
.chat-filter > span, .chat-compose label > span { flex: 0 0 52px; color: var(--chat-muted); font-size: 11px; }
.chat-filter select { flex: 1; min-width: 0; padding: 5px 8px; font-size: 12px; background: #101e31; border-color: #293d55; }
.chat-messages { flex: 1; min-height: 80px; overflow-y: auto; overscroll-behavior: contain; padding: 8px 12px; overflow-anchor: none; scrollbar-width: thin; scrollbar-color: #30465d transparent; }
.chat-message { padding: 8px 3px 9px; overflow-wrap: anywhere; border-bottom: 1px solid #ffffff05; }
.chat-message-self { background: #4787be08; border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.chat-message-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.chat-channel-tag { color: hsl(var(--channel-hue) 65% 73%); background: hsl(var(--channel-hue) 55% 53% / .1); border: 1px solid hsl(var(--channel-hue) 55% 53% / .12); border-radius: 4px; padding: 0 5px; font-size: 9px; line-height: 17px; }
.chat-message-time { color: #607792; font-size: 9px; font-variant-numeric: tabular-nums; }
.chat-message-body { color: #cbd8e8; white-space: pre-wrap; line-height: 1.5; font-size: 12px; }
.chat-message-sender { color: #9ccfe8; font-weight: 600; }
.chat-message-self .chat-message-sender { color: #83d7bc; }
.chat-empty { min-height: 180px; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: #6f87a3; font-size: 11px; text-align: center; }
.chat-empty strong { font-size: 12px; color: #9db2c9; font-weight: 500; }
.chat-empty-mark { font-size: 32px; letter-spacing: 3px; line-height: 30px; margin-bottom: 8px; color: #639baf; border: 1px solid #3c677d50; border-radius: 12px 12px 12px 3px; padding: 0 9px 9px; }
.chat-notice { margin: 0; padding: 8px 14px; font-size: 10px; color: #dcc294; background: #dec79506; line-height: 1.45; }
.chat-notice:empty { display: none; }
.chat-compose { padding: 11px 14px 12px; border-top: 1px solid #30415888; background: #101d30; display: flex; flex-direction: column; gap: 9px; }
.chat-compose label { display: flex; align-items: center; gap: 12px; }
.chat-compose select { flex: 1; min-width: 0; padding: 5px 8px; font-size: 12px; border-color: #33566a; background: #142b3b; }
.chat-compose textarea { resize: none; max-height: 100px; min-height: 62px; width: 100%; box-sizing: border-box; background: #0b1727; border-color: #2b4058; font-size: 12px; line-height: 1.5; }
.chat-compose textarea::placeholder { color: #5c7590; }
.chat-compose-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chat-compose-actions > span { font-size: 9px; color: #6d87a2; }
.chat-compose-actions button { display: flex; align-items: center; justify-content: center; gap: 8px; background: #277d8b; border-color: #3a9caa; padding: 6px 15px; font-size: 12px; font-weight: 600; box-shadow: 0 2px 8px #0002; }
.chat-compose-actions button:hover:enabled { background: #318f9a; border-color: #69c6c9; }
.chat-new { align-self: center; margin: 3px auto 7px; font-size: 10px !important; padding: 4px 12px !important; color: #9de2e4 !important; border-color: #437786 !important; border-radius: 20px !important; }
.monitor-chat [hidden] { display: none !important; }
.chat-game-icon { display: inline-block; vertical-align: middle; object-fit: contain; max-width: 32px; max-height: 24px; margin: 0 1px; }
.chat-draft-preview { max-height: 44px; overflow-y: auto; overflow-wrap: anywhere; font-size: 11px; color: #cbd8e8; padding: 5px 8px; border-left: 2px solid #3f8b92; background: #172b3d; border-radius: 3px 6px 6px 3px; }
.chat-icon-picker { border: 1px solid #34516a; border-radius: 10px; background: #0c192a; overflow: hidden; }
.chat-picker-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; color: #91b5cc; font-size: 10px; border-bottom: 1px solid #ffffff0a; }
.chat-picker-head button { border: 0; background: transparent; padding: 0 5px; font-size: 18px; }
.chat-icon-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; max-height: 142px; padding: 7px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.chat-icon-grid .chat-icon-option { display: grid; place-items: center; min-width: 0; height: 32px; padding: 3px; border: 1px solid transparent; border-radius: 6px; background: #172a3c66; }
.chat-compose-actions .chat-picker-toggle { background: #1a3043; border-color: #304c61; color: #a9cfda; padding: 5px 8px; gap: 5px; box-shadow: none; font-size: 10px; font-weight: 500; }
.chat-picker-toggle[aria-expanded="true"] { border-color: #60bbb7; color: #a0ebe5; }
.chat-compose-actions > span { flex: 1; text-align: right; }
@media (max-width: 640px) {
  .monitor-chat { inset: 8px; top: max(8px, env(safe-area-inset-top)); bottom: max(8px, env(safe-area-inset-bottom)); width: auto; height: auto; border-radius: 14px; }
  .chat-head { padding-top: 10px; padding-bottom: 10px; }
  .chat-head button { width: 36px; height: 36px; }
  .chat-compose textarea { font-size: 16px; }
  .chat-compose-actions > span { font-size: 9px; }
  .chat-compose-actions button { min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) { .monitor-chat button { transition: none; } }
