/* Compact floor chat. Shared palette and typography come from ui-kit.css. */
#community-chat { --chat-height: 170px; box-sizing: border-box; position: absolute; inset: auto auto 18px 18px; z-index: 15; width: min(420px, calc(100% - 36px)); height: var(--chat-height); max-height: calc(100dvh - 36px); margin: 0; padding: 0; border: 1px solid var(--kit-line-strong); border-radius: 8px; overflow: hidden; background: rgba(17,26,34,.64); color: #fff; font-size: 14px; opacity: .78; transition: background .18s, opacity .18s; box-shadow: 0 4px 16px #0003; }
#community-chat[open] { display: flex; flex-direction: column; }
#community-chat:hover, #community-chat:focus-within { opacity: 1; background: rgba(17,26,34,.96); }
#community-chat .chat-header { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--kit-line); border-top: 2px solid var(--kit-red); flex-shrink: 0; }
#community-chat .chat-room { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; }
#community-chat .chat-room select { flex: 1; min-width: 0; padding: 4px 8px; min-height: 32px; background: transparent; font-size: 14px; }
#community-chat .chat-close { width: 32px; min-height: 32px; padding: 0; font: 24px/1 sans-serif; border: 0; background: transparent; }
#community-chat p { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
#community-chat .chat-status { color: var(--kit-muted); font-size: 12px; padding: 3px 10px; flex-shrink: 0; }
#community-chat[data-state="connected"] .chat-status { color: var(--kit-teal); }
#community-chat .chat-presence { display: none; }
#community-chat .chat-connection { padding: 4px 10px; }
#community-chat .chat-connection:not(:has(button:not([hidden]))) { display: none; }
#community-chat .chat-messages { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 4px 10px; scrollbar-width: thin; scrollbar-color: #8b978f transparent; overflow-anchor: none; }
#community-chat .chat-messages article { position: relative; padding: 1px 26px 1px 0; line-height: 20px; overflow-wrap: anywhere; white-space: pre-wrap; }
#community-chat .chat-sender { font-weight: 600; color: #fff; }
#community-chat .chat-sender[data-tier="bronze"] { color: #d69662; }
#community-chat .chat-sender[data-tier="silver"] { color: #e2e6ec; }
#community-chat .chat-sender[data-tier="gold"], #community-chat .chat-sender[data-tier="moderator"] { color: #ffd36a; }
#community-chat .chat-sender[data-tier="platinum"] { color: #a3e5df; }
#community-chat .chat-sender[data-tier="diamond"] { color: #8dcaff; }
#community-chat .chat-sender[data-tier="elite"] { color: #d4acff; }
#community-chat .chat-message-menu { display: inline; white-space: normal; }
#community-chat .chat-message-menu > summary { position: absolute; right: 0; top: 0; padding: 0; width: 24px; height: 22px; text-align: center; list-style: none; color: var(--kit-muted); cursor: pointer; }
#community-chat .chat-message-actions { display: flex; gap: 6px; padding: 4px 0; }
#community-chat .chat-message-actions .kit-button { min-height: 32px; padding: 4px 10px; font-size: 11px; }
#community-chat .chat-empty { display: grid; place-content: center; text-align: center; height: 100%; gap: 4px; color: var(--kit-muted); font-size: 12px; }
#community-chat .chat-empty strong { color: var(--kit-ink); font-size: 14px; font-weight: 600; }
#community-chat .chat-compose { padding: 6px 8px; border-top: 1px solid var(--kit-line); flex-shrink: 0; }
#community-chat form { display: flex; align-items: stretch; gap: 6px; }
#community-chat textarea { flex: 1; min-width: 0; height: 36px; min-height: 36px; max-height: 80px; resize: none; padding: 7px 9px; font-size: 14px; border-radius: 5px; background: #ffffff0a; }
#community-chat textarea:focus { border-color: var(--kit-teal); }
#community-chat form .kit-primary { width: 36px; min-height: 36px; padding: 8px; flex-shrink: 0; }
#community-chat form svg { width: 20px; height: 20px; display: block; }
#community-chat .chat-compose-help { display: none; visibility: hidden; justify-content: space-between; gap: 8px; color: var(--kit-muted); font-size: 10px; padding-top: 4px; }
#community-chat .chat-compose:focus-within .chat-compose-help { visibility: visible; }
#community-chat .chat-moderation { padding: 0 10px; flex-shrink: 0; max-height: 160px; overflow: auto; background: var(--kit-deep); font-size: 12px; }
#community-chat .chat-moderation:not([open]) { display: none; }
#community-chat summary { cursor: pointer; padding: 6px 0; color: var(--kit-muted); }
#community-chat .chat-moderation > :not(summary) { margin-bottom: 8px; }
#community-chat .chat-moderation input, #community-chat .chat-moderation select { width: 100%; }
#community-chat .chat-field-label { display: grid; gap: 4px; }
#community-chat .chat-warnings:empty { display: none; }
#community-chat .chat-warnings { margin: 4px 10px; padding: 8px; border-left: 3px solid var(--kit-red); background: var(--kit-deep); max-height: 90px; overflow: auto; flex-shrink: 0; }
#community-chat .chat-spinner { display: block; width: 24px; height: 24px; margin: 0 auto 6px; border: 2px solid var(--kit-line); border-top-color: var(--kit-teal); border-radius: 50%; animation: chat-spin .8s linear infinite; }
@keyframes chat-spin { to { transform: rotate(360deg); } }
@media (max-width: 600px) { #community-chat { --chat-height: 178px; inset: auto auto 8px 8px; width: calc(100% - 16px); max-height: calc(100dvh - 16px); } #community-chat .chat-room select, #community-chat .chat-close, #community-chat form .kit-primary, #community-chat textarea { min-height: 44px; } }
@media (max-height: 500px) { #community-chat { --chat-height: 137px; bottom: 8px; max-height: calc(100dvh - 16px); } #community-chat:has(.chat-moderation[open]) .chat-messages { display: none; } }
@media (prefers-reduced-motion: reduce) { #community-chat { transition: none; } #community-chat .chat-spinner { animation-duration: 1.8s; } }

/* Keep recovery and moderation usable without enlarging the idle chat. */
#community-chat:has(.chat-moderation[open]), #community-chat:has(.chat-warnings:not(:empty)), #community-chat:has(.chat-connection button:not([hidden])) { height: auto; }
#community-chat .chat-loading { grid-template-columns: 24px auto; align-content: center; align-items: center; gap: 8px; }
#community-chat .chat-loading p { display: none; }
#community-chat .chat-loading .chat-spinner { margin: 0; }
/* Compact chrome leaves room for readable messages at half height. */
#community-chat form { margin: 0; }
#community-chat .chat-compose-help { display: none; }
@media (max-height: 500px) {
    #community-chat .chat-header { padding: 2px 8px; }
    #community-chat .chat-room select, #community-chat .chat-close { min-height: 26px; height: 26px; }
    #community-chat .chat-status { padding: 0 10px; font-size: 11px; line-height: 14px; }
    #community-chat .chat-compose { padding: 4px 8px; }
}

@media (pointer: coarse) and (orientation: landscape) {
    #community-chat { --chat-height: 132px; inset: auto auto 8px 8px; width: min(240px, calc(100% - 16px)); max-height: calc(100dvh - 16px); font-size: 13px; }
    #community-chat .chat-header { gap: 4px; padding: 2px 6px; }
    #community-chat .chat-room select, #community-chat .chat-close { min-height: 30px; height: 30px; }
    #community-chat .chat-status { padding: 0 6px; font-size: 11px; line-height: 14px; }
    #community-chat .chat-messages { margin: 2px 6px; }
    #community-chat .chat-messages article { line-height: 17px; }
    #community-chat .chat-compose { padding: 2px 6px; }
    #community-chat textarea { height: 34px; min-height: 34px; padding: 5px 6px; font-size: 16px; }
    #community-chat form .kit-primary { width: 34px; min-height: 34px; padding: 7px; }
}
