/* Realm chat: a compact companion to the carved game HUD. */
#realm-chat {
  position: fixed; left: 16px; bottom: calc(190px * var(--ui-scale, 1)); z-index: 18;
  zoom: calc(1 / var(--ui-scale, 1)); width: min(420px, calc(100vw - 32px)); box-sizing: border-box;
  max-height: calc(100vh - 190px * var(--ui-scale, 1) - 28px); display: flex; flex-direction: column;
  border: 12px solid transparent; border-image: url('/activity/assets/kit/d/panels/panel-q-1.png') 20 / 12px stretch;
  background: #15120ff2; background-clip: padding-box; box-shadow: 0 8px 24px #0006;
  color: var(--parch); font: 12px/1.45 var(--f-ui); image-rendering: pixelated;
}
#realm-chat.collapsed { width: 270px; background-color: #15120fd9; }
.at-title #realm-chat, .cine #realm-chat, .at-title #chat-item-inspect, .cine #chat-item-inspect,
#ui:has(#centre:not([hidden])) #realm-chat, #ui:has(#centre:not([hidden])) #chat-item-inspect { visibility: hidden; }
.chat-header { display: flex; align-items: center; gap: 8px; padding: 3px 5px 6px; flex: none; }
.collapsed .chat-header { padding-bottom: 3px; }
.chat-heading { display: flex; align-items: center; gap: 8px; color: var(--gold-hi); border: 0; background: none; padding: 0; cursor: pointer; font: 16px var(--f-title); }
.chat-light { width: 5px; height: 5px; border-radius: 50%; background: #82766a; box-shadow: 0 0 0 2px #0005; }
.chat-light.online { background: #93b176; box-shadow: 0 0 5px #93b17670; }
.chat-unread { border-radius: 2px; padding: 1px 5px; background: #745026; color: #f9e6bc; font: 10px var(--f-ui); }
.chat-small-close, .chat-inspect-close { margin-left: auto; flex: none; width: 22px; height: 22px; background: url('/activity/assets/kit/d/menuicons/menuicons-a3.png') center / 100% 100%; border: 0; color: transparent; cursor: pointer; image-rendering: pixelated; }
.chat-small-close:hover, .chat-inspect-close:hover { background-image: url('/activity/assets/kit/d/menuicons/menuicons-b3.png'); }
.chat-wake { margin-left: auto; color: var(--parch-dim); font: 10px var(--f-ui); background: none; border: 0; padding: 0; cursor: pointer; }
.chat-channels { display: flex; gap: 6px; align-items: center; padding: 2px 5px 0; flex: none; }
.chat-channels > button { height: 27px; border: 0 solid transparent; border-width: 0 9px; border-image: url('/activity/assets/kit/d/titles/title-b.png') 0 6 fill / 0 9px stretch; padding: 0 8px; background: none; color: var(--parch-dim); font: 11px var(--f-ui); cursor: pointer; }
.chat-channels > button[aria-pressed='true'] { border-image-source: url('/activity/assets/kit/d/titles/title-c.png'); color: var(--gold-hi); }
.chat-channels b { margin-left: 4px; color: var(--gold-hi); font-size: 9px; }
.chat-channels > .chat-community { margin-left: auto; border: 0; padding: 0; }
.chat-scope { padding: 6px 7px; font-size: 10px; color: var(--parch-faint); flex: none; }
.chat-history { height: min(210px, 32vh); min-height: 64px; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 8px 9px; border-top: 1px solid #58472d70; border-bottom: 1px solid #58472d70; background: #08070570; display: flex; flex-direction: column; gap: 8px; user-select: text; }
.chat-history, #chat-item-inspect { scrollbar-width: thin; scrollbar-color: #82663b #100d08; }
.chat-history::-webkit-scrollbar, #chat-item-inspect::-webkit-scrollbar { width: 6px; }
.chat-history::-webkit-scrollbar-track, #chat-item-inspect::-webkit-scrollbar-track { background: #100d08; }
.chat-history::-webkit-scrollbar-thumb, #chat-item-inspect::-webkit-scrollbar-thumb { background: #82663b; border: 1px solid #b3935b; }
#ui:has(#party-notice:not([hidden])) #realm-chat .chat-history { height: min(120px, 20vh); }
.chat-message { display: flex; gap: 8px; flex: none; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.chat-message time { color: #887d6c; font-size: 9px; padding-top: 3px; flex: none; }
.chat-message > div { min-width: 0; }
.chat-author { border: 0; background: none; padding: 0; color: #adc9d8; font: 12px var(--f-ui); cursor: help; }
.chat-author::after { content: ':'; margin-right: 5px; color: #887d6c; }
.self .chat-author { color: #b9c99d; }
.chat-message-text { white-space: pre-wrap; }
.chat-empty { margin: auto; display: flex; align-items: center; gap: 12px; color: var(--parch-dim); }
.chat-empty p { margin: 0; font: 15px var(--f-title); }
.chat-empty small { display: block; margin-top: 4px; font: 10px/1.5 var(--f-ui); color: var(--parch-faint); }
.chat-item-link { display: inline; border: 0; background: none; padding: 0; color: var(--rc); font: 12px var(--f-ui); cursor: pointer; }
.chat-item-link:hover { color: #f4dec2; text-decoration: underline; }
.chat-attached { display: flex; flex-wrap: wrap; gap: 5px; padding: 6px 5px 0; flex: none; }
.chat-attached > span { padding: 3px 5px; border: 1px solid #695136; background: #090705; }
.chat-attached .chat-item-link { font-size: 10px; }
.chat-attached button[data-remove] { margin-left: 6px; background: none; border: 0; color: var(--parch-dim); cursor: pointer; }
.chat-compose { display: flex; align-items: center; gap: 7px; margin: 7px 4px 0; height: 35px; flex: none; border: 1px solid #635036; background: #070503; }
.chat-compose:focus-within { border-color: #b69762; box-shadow: 0 0 8px #b6976220; }
.chat-compose > span { padding-left: 8px; color: var(--gold); font-size: 10px; }
.chat-compose input { min-width: 0; flex: 1; background: none; border: 0; color: #e5dac2; font: 12px var(--f-ui); outline: none; height: 100%; padding: 0; }
.chat-compose > button { width: 30px; height: 100%; border: 0; border-left: 1px solid #635036; background: #59432430; color: var(--gold-hi); cursor: pointer; font-size: 19px; }
.chat-compose > button:disabled { opacity: .35; cursor: default; }
.chat-foot { display: flex; gap: 8px; align-items: center; padding: 7px 5px 2px; font-size: 9px; color: var(--parch-faint); flex: none; }
.chat-foot > button { display: flex; align-items: center; gap: 4px; background: none; border: 0; padding: 0; color: var(--gold); font: 10px var(--f-ui); cursor: pointer; flex: none; }
.chat-foot > span { margin-left: auto; text-align: right; }
#chat-item-inspect { position: fixed; z-index: 19; left: 452px; bottom: calc(190px * var(--ui-scale, 1)); zoom: calc(1 / var(--ui-scale, 1)); width: 324px; max-height: calc(100vh - 190px * var(--ui-scale, 1) - 28px); overflow: auto; background: #090705f7; background-clip: padding-box; border: 12px solid transparent; border-image: url('/activity/assets/kit/d/panels/panel-h.png') 20 / 12px stretch; box-shadow: 0 8px 28px #0008; text-align: center; }
.chat-inspect-close { position: absolute; top: 5px; right: 5px; }
.chat-inspect-label { display: block; padding: 10px 22px 12px; color: var(--parch-dim); font: 9px var(--f-ui); letter-spacing: 1px; }
.chat-inspect-foot { display: flex; align-items: center; gap: 10px; padding: 10px 12px; text-align: left; font-size: 11px; }
.chat-inspect-foot small { display: block; color: var(--parch-faint); font-size: 10px; }
@media (max-width: 800px) { #chat-item-inspect { left: auto; right: 16px; width: min(324px, calc(100vw - 56px)); } }
@media (max-height: 560px) { .chat-history { height: 110px; } }
