/* Independent category row: existing headers, composers and room palettes stay intact. */
.xixi-chat-category-tabs[hidden]{display:none!important}
.xixi-chat-category-tabs{display:flex;flex:0 0 auto;align-items:stretch;border-bottom:1px solid var(--border);background:transparent;min-height:40px;z-index:1}
.xixi-chat-category-tab{flex:1 1 0;min-width:0;display:flex;align-items:center;justify-content:center;gap:5px;padding:8px 3px;border:0;border-radius:0;box-shadow:none;background:transparent;color:var(--muted);font:inherit;font-size:12px;line-height:1.35;overflow-wrap:anywhere;position:relative;isolation:isolate}
.xixi-chat-category-tab::before,.xixi-chat-category-tab::after{display:none!important}
.xixi-chat-category-tab[aria-selected=true]{font-weight:700;color:var(--xixi-category-accent);border-bottom:3px solid var(--xixi-category-accent);padding-bottom:5px}
.xixi-chat-category-tab+.xixi-chat-category-tab{border-left:1px solid var(--border)}
.xixi-chat-category-tab:focus-visible{outline:2px solid var(--xixi-category-accent);outline-offset:-3px}
.xixi-chat-category-tab .xixi-category-unread{background:var(--xixi-category-accent);color:white;font-size:10px;min-width:16px;height:16px;line-height:16px;text-align:center;border-radius:50%;padding:0 3px}
.xixi-category-online{width:7px;height:7px;background:#4db56b;border-radius:50%;flex:none}
#globalChatPanel{--xixi-category-accent:#2563eb}#realtimeDuelChatPanel{--xixi-category-accent:#8c6bcd}#familyChatPanel{--xixi-category-accent:#a76237}
#dmChatPanel{--xixi-category-accent:#0d9d87;--dm-background:#f3fffb;--dm-header:#e5f7f0;--dm-bubble:#d8eee6;--dm-text:#195e54;--dm-border:#86cdbc;color:var(--dm-text);background:var(--dm-background);border-color:var(--dm-border);position:fixed}
body.theme-dark #dmChatPanel{--xixi-category-accent:#45cdb2;--dm-background:#102620;--dm-header:#193b32;--dm-bubble:#28554a;--dm-text:#d8f7ed;--dm-border:#3d7a68}
#dmChatPanel .realtime-duel-chat-header{background:var(--dm-header);border-color:var(--dm-border)}
#dmChatPanel .realtime-duel-chat-header-actions>button{color:var(--dm-text);background:var(--dm-bubble);border-color:var(--dm-border)}
#dmChatPanel .xixi-chat-category-tabs{background:var(--dm-background);border-color:var(--dm-border)}
#dmChatPanel .xixi-chat-category-tab{color:var(--dm-text);border-left-color:var(--dm-border)}
#dmChatPanel .xixi-chat-category-tab[aria-selected=true]{color:var(--xixi-category-accent)}
.xixi-dm-title-group{display:flex;align-items:center;gap:8px;min-width:0}.xixi-dm-title-group .xixi-avatar{width:32px;height:32px;flex:none}.xixi-dm-title-group h3{overflow-wrap:anywhere;margin:0}
#dmChatBack{flex:none;background:transparent;color:inherit;padding:3px;border:0;font-size:22px;width:24px;box-shadow:none}
#dmChatBack[hidden],.xixi-dm-compose[hidden],.xixi-dm-footer[hidden],#dmChatPanel [hidden]{display:none!important}
#dmChatMessages{background:var(--dm-background);min-height:0;overflow-y:auto;overscroll-behavior:contain;overflow-anchor:none;flex:1 1 auto;scroll-behavior:auto}
.xixi-dm-list-row{display:flex;width:100%;align-items:center;gap:9px;min-height:70px;padding:12px 0;border:0;border-bottom:1px solid var(--dm-border);border-radius:0;background:transparent;box-shadow:none;text-align:left;color:inherit;font:inherit}
.xixi-dm-list-row::before,.xixi-dm-list-row::after{display:none!important}
.xixi-dm-list-row .xixi-avatar{width:36px;height:36px;flex:none}.xixi-dm-list-summary{flex:1;min-width:0}.xixi-dm-peer-nick{display:block;font-size:.938rem}
.xixi-dm-passive-nick{display:inline;color:inherit;font:inherit;font-weight:600;text-align:inherit;overflow-wrap:anywhere}
.xixi-dm-passive-nick:is(.season-honor-1,.season-honor-2,.season-honor-3){font-weight:400!important;white-space:nowrap;overflow:visible;text-overflow:clip}.xixi-dm-last-text{margin-top:.2rem;font-size:.82rem;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;opacity:.75}.xixi-dm-list-status{display:flex;flex-direction:column;align-items:flex-end;gap:6px;font-size:.75em}
.xixi-dm-unread{display:inline-flex;border-radius:50%;padding:2px 6px;min-width:20px;justify-content:center;background:var(--xixi-category-accent);color:white;font-weight:700}
.xixi-dm-footer{flex:0 0 auto;padding:10px 12px;border-top:1px solid var(--dm-border)}
#dmChatNew{width:100%;color:var(--xixi-category-accent);border:1px solid var(--dm-border);background:transparent}
#dmChatPanel .realtime-duel-chat-compose{border-top-color:var(--dm-border);background:var(--dm-background)}
#dmChatInput{color:var(--dm-text);border-color:var(--dm-border);background:var(--dm-background)}
#dmChatSend{background:var(--xixi-category-accent);color:white}
#dmChatPanel .realtime-duel-chat-hint{color:var(--dm-text);background:var(--dm-background);opacity:.75}
.xixi-dm-message{display:flex;gap:8px;align-items:flex-end;margin:10px 0;color:var(--dm-text)}
.xixi-dm-message.outgoing{justify-content:flex-end}.xixi-dm-message .xixi-avatar{width:30px;height:30px;flex:none}.xixi-dm-message.outgoing>.xixi-avatar{order:1}.xixi-dm-message-body{max-width:calc(100% - 40px);min-width:0}.xixi-dm-message-meta{display:flex;align-items:center;gap:7px;font-size:.8em;opacity:.8;margin-bottom:4px;flex-wrap:wrap}.xixi-dm-message.outgoing .xixi-dm-message-meta{justify-content:flex-end}
.xixi-dm-bubble{background:var(--dm-bubble);padding:10px 12px;border-radius:15px;white-space:pre-wrap;overflow-wrap:anywhere}.outgoing .xixi-dm-bubble{background:var(--xixi-category-accent);color:white}.xixi-dm-attachment{display:flex;flex-direction:column;gap:5px;padding-top:5px;overflow-wrap:anywhere}.xixi-dm-attachment img,.xixi-dm-attachment video{max-width:100%;max-height:230px;border-radius:10px}.xixi-dm-attachment button{color:var(--dm-text);background:var(--dm-header);border-color:var(--dm-border);font:inherit}
.xixi-dm-search{flex:0 0 auto;padding:8px 12px;background:var(--dm-header)}.xixi-dm-search input{width:100%}.xixi-dm-selected-file{padding:5px 12px;display:flex;align-items:center;gap:8px;flex:0 0 auto;overflow-wrap:anywhere}.xixi-dm-selected-file span{flex:1;min-width:0}.xixi-dm-status{padding:14px 2px;font-size:.9em}.xixi-dm-more{display:block;margin:0 auto 8px}
#dmChatJump{right:auto;bottom:auto}
#dmChatPanel .xixi-chat-text-settings{background:var(--dm-header);color:var(--dm-text);border-color:var(--dm-border)}

.xixi-dm-title-copy{min-width:0}.xixi-dm-title-copy h3,.xixi-dm-title-copy .realtime-duel-chat-subtitle{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.xixi-dm-title-group{flex:1}.xixi-dm-title-avatar:empty{display:none}
/* Category height is 40px. All labels use the 37px content box;
   the independent 3px underline never shifts selected text. */
html body .xixi-chat-category-tabs{height:40px;min-height:40px}
html body .xixi-chat-category-tab{height:40px;box-sizing:border-box;padding:0 3px 3px;border-bottom:0;line-height:1.35}
html body .xixi-chat-category-tab[aria-selected=true]{padding:0 3px 3px;border-bottom:0}
html body .xixi-chat-category-tab[aria-selected=true]::after{display:block!important;content:'';position:absolute;inset:auto 0 0;height:3px;background:var(--xixi-category-accent);pointer-events:none}
html body .realtime-duel-chat-panel.xixi-chat-switching600{transition:none!important}


/* The global outline now matches the visual weight of the other palettes. */
html body #globalChatPanel{border-color:#91abc9;--chat-control-bg600:#dbeafe;--chat-control-text600:#1e3a8a}
html body.theme-dark #globalChatPanel{border-color:#627a9e;--chat-control-bg600:#1e3a5f;--chat-control-text600:#dbeafe}
html body #realtimeDuelChatPanel{--chat-control-bg600:#e7e0f4;--chat-control-text600:#574379}
html body.theme-dark #realtimeDuelChatPanel{--chat-control-bg600:#39304f;--chat-control-text600:#e4dcf7}
html body #familyChatPanel{--chat-control-bg600:var(--family-bubble576);--chat-control-text600:var(--family-text576)}
html body #dmChatPanel{--chat-control-bg600:var(--dm-bubble);--chat-control-text600:var(--dm-text)}
html body :is(#globalChatPanel,#realtimeDuelChatPanel,#familyChatPanel,#dmChatPanel) :is(.realtime-duel-chat-header-actions,.family-chat-header-actions)>button{
 width:30px;height:30px;min-width:30px;min-height:30px;padding:0!important;flex:none;display:inline-flex;align-items:center;justify-content:center;
 border:0;border-radius:12px!important;background-color:var(--chat-control-bg600)!important;color:var(--chat-control-text600)!important;line-height:1;
}
html body :is(#globalChatPanel,#realtimeDuelChatPanel,#familyChatPanel,#dmChatPanel) :is(.realtime-duel-chat-header-actions,.family-chat-header-actions)>button>svg{width:14.4px!important;height:14.4px!important}
html body :is(#globalChatPanel,#realtimeDuelChatPanel,#familyChatPanel,#dmChatPanel) .xixi-chat-settings-button>svg{width:18px!important;height:18px!important}
html body #dmChatPanel .realtime-duel-chat-bubble{background:var(--dm-bubble);color:var(--dm-text)}
html body #dmChatPanel .mine .realtime-duel-chat-bubble{background:var(--xixi-category-accent);color:#fff}
html body #dmChatPanel :is(.realtime-duel-chat-nick,.realtime-duel-chat-meta,.chat-media-menu,.chat-attachment-selection){color:var(--dm-text)}
.xixi-dm-list-row>strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* Reuse the site's standard modal palette, typography and action spacing. */
:is(#dmMemberOnlyDialog,#dmLeaveConversationDialog606){position:fixed;inset:0;margin:auto;width:max-content;min-width:0;max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);border:1px solid #cbd5e1;font:inherit;color:inherit}
:is(#dmMemberOnlyDialog,#dmLeaveConversationDialog606)::backdrop{background:rgba(0,0,0,.45)}
body.theme-dark :is(#dmMemberOnlyDialog,#dmLeaveConversationDialog606){border-color:#334155}
body.theme-dark :is(#dmMemberOnlyDialog,#dmLeaveConversationDialog606)::backdrop{background:rgba(0,0,0,.65)}
:is(#dmMemberOnlyDialog,#dmLeaveConversationDialog606) .modal-actions{flex-wrap:wrap}

/* DM titles share the established chat typography and use all available space. */
#dmChatPanel .xixi-dm-title-group{flex:1 1 0;min-width:0}
#dmChatPanel .xixi-dm-title-copy{flex:1 1 0;min-width:0}
#dmChatPanel .xixi-dm-title-group .realtime-duel-chat-title{color:var(--dm-text);line-height:normal}
#dmChatPanel .xixi-dm-title-copy .realtime-duel-chat-subtitle{color:var(--dm-text);opacity:.75}
.xixi-dm-title-tip{position:fixed;z-index:10100;box-sizing:border-box;padding:7px 10px;border:1px solid var(--dm-border,#86cdbc);border-radius:8px;background:#e5f7f0;color:#195e54;box-shadow:0 4px 14px #0003;font:inherit;font-size:.82rem;line-height:1.4;overflow-wrap:anywhere;pointer-events:none}
body.theme-dark .xixi-dm-title-tip{background:#193b32;color:#d8f7ed;border-color:#3d7a68}
.xixi-dm-title-tip[hidden]{display:none}

/* Per-user conversation controls retain the established message-menu design. */
.xixi-dm-list-stamp{display:inline-flex;align-items:center;gap:5px;white-space:nowrap}
.xixi-dm-pin{display:inline-flex;align-items:center;color:var(--xixi-category-accent);flex:none}
.xixi-dm-pin svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.xixi-dm-list-row{user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}
.xixi-dm-room-settings hr{border:0;border-top:1px solid var(--dm-border);margin:10px 0}
.xixi-dm-room-settings>button{width:100%;font:inherit;color:var(--dm-text);background:var(--dm-bubble)}
.xixi-dm-recipient-count{position:sticky;top:0;z-index:2;padding:7px 0;background:var(--dm-background);font-size:.85em;color:var(--dm-text)}
#dmChatPanel[data-dm-view="new"] .xixi-dm-search{padding-bottom:8px}
#dmChatPanel[data-dm-view="new"] #dmChatMessages{padding-top:0}
.xixi-dm-recipient-divider{border-top:1px solid var(--dm-border)}
.xixi-dm-recipient-sentinel{padding:12px 0;text-align:center;font-size:.85em;color:var(--dm-text)}

/* Compact only recipient rows; conversation cards retain their existing height. */
.xixi-dm-list-row[data-dm-peer]{min-height:60px;padding-block:10px}

.xixi-dm-list-retry{display:block;margin:0 auto 8px}

/* Shared source dialog uses the site's existing message-box/buttons. */
.xixi-media-source616{position:fixed;inset:auto;margin:0;transform:translate(-50%,-50%);box-sizing:border-box;min-width:0;width:max-content;padding:22px;border:1px solid var(--border);border-radius:18px;max-height:85vh;color:var(--text)}
.xixi-media-source616::backdrop{background:rgba(0,0,0,.45)}
.xixi-media-source616 h2{margin:0 0 16px;font-size:1rem}
.xixi-media-source-actions616{display:flex;flex-direction:column;gap:10px}
.xixi-media-source-actions616 button{display:flex;align-items:center;gap:14px;min-height:52px;text-align:left;width:100%}
.xixi-media-source-actions616 img{width:32px;height:32px;flex:none}
.xixi-media-source616 .modal-actions{margin-top:18px;justify-content:flex-end}
.xixi-media-source616:has(.xixi-source-camera616){width:320px}
.xixi-source-camera616{width:100%;max-height:45vh;object-fit:contain;border-radius:8px;background:#111827}

/* Camera capture is a compact centered action, separate from source choices. */
.xixi-media-source-actions616 button.xixi-source-take618{width:max-content;max-width:100%;min-width:0;min-height:0;align-self:center;justify-content:center;text-align:center}
