/* ChatRoom feature additions. Keep the existing shell, wallet gate and avatar style. */
.window.chatroom-app [hidden] { display:none!important; }
#chat-tabs { display:flex; flex:none; gap:5px; overflow:auto; padding:10px 18px 0; scrollbar-width:thin; }
.chat-tab { display:flex; flex:none; align-items:center; border:1px solid #ffffff13; border-radius:8px; background:#ffffff03; }
.chat-tab.active { border-color:#b8cbe459; background:#b8cbe414; }
.window.chatroom-app .chat-tab button { display:flex; align-items:center; gap:7px; min-height:31px; padding:5px 9px; border:0; background:transparent; color:var(--chat-text); font-size:11px; }
.window.chatroom-app .chat-tab .chat-close-tab { padding:5px 9px 5px 3px; font-size:18px; color:var(--chat-text-dim); }
.chat-unread-dot { display:inline-block; width:7px; height:7px; border-radius:50%; background:#e17b8b; }
.chat-unread-count,#chat-inbox-count { display:inline-block; min-width:16px; padding:1px 4px; border-radius:8px; background:#a64a60; color:#fff; text-align:center; font-size:10px; line-height:1.4; }
.chat-room-heading { min-width:0; }
#chat-room-title { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#chat-room-kind { display:block; max-width:38ch; color:var(--chat-text-dim); font-size:9px; line-height:1.4; }
.chat-header-actions { display:flex; align-items:center; gap:6px; flex:none; }
#chat-inbox-btn { min-height:32px; padding:6px 9px; border:1px solid var(--chat-border); border-radius:8px; color:var(--chat-text); background:#ffffff03; font-size:11px; white-space:nowrap; }
#chat-status { flex:none; max-height:72px; overflow:auto; margin:8px 18px 0; padding:8px 10px; border:1px solid #e2b2ba44; border-radius:7px; background:#a747541a; color:#efbdc4; font-size:11px; }
#chat-private-notice { position:absolute; z-index:14; bottom:calc(100% + 8px); left:14px; right:14px; width:max-content; max-width:calc(100% - 28px); box-sizing:border-box; margin-inline:auto; padding:10px 13px; border:1px solid #b8cbe44d; border-radius:9px; background:#303945; color:var(--chat-text); box-shadow:0 5px 18px #0004; font-size:12px; line-height:1.6; overflow-wrap:anywhere; pointer-events:none; }
#chat-input-area { position:relative; }
#chat-ban-notice { position:absolute; inset:0; z-index:12; display:flex; align-items:center; gap:12px; box-sizing:border-box; padding:14px 16px; border:1px solid #d8899b80; border-radius:inherit; background:#352b35; color:#f0d3dc; box-shadow:inset 0 0 20px #b95c7710; text-align:left; pointer-events:none; }
.chat-ban-symbol { display:grid; place-items:center; flex:none; width:30px; height:30px; border:1px solid #dfa1b36b; border-radius:50%; background:#d8899b16; color:#efb1c1; font-size:17px; font-weight:600; }
#chat-ban-notice strong { display:block; margin-bottom:3px; color:#f5dfe6; font-size:12px; font-weight:600; line-height:1.5; }
#chat-ban-notice-text { display:block; font-size:11px; line-height:1.6; overflow-wrap:anywhere; }
#chat-jump-latest { align-self:center; flex:none; margin:3px 10px; padding:5px 12px; border:1px solid #b8cbe44d; border-radius:15px; background:#354353; color:#dce6f2; font-size:11px; }
#chat-messages { position:relative; overflow-anchor:none; }
#chat-messages:focus,#chat-messages .chat-msg:focus,.window.chatroom-app .content #chat-messages button:focus,.window.chatroom-app .content #chat-message-menu button:focus { outline:none; }
.window.chatroom-app .chat-msg-avatar { padding:0; cursor:pointer; }
.window.chatroom-app .chat-msg-avatar:disabled { opacity:1; cursor:default; }
.window.chatroom-app .chat-msg-wallet { padding:0; border:0; background:transparent; text-align:left; font:600 11px var(--chat-mono); cursor:pointer; }
.window.chatroom-app .chat-msg-wallet:disabled { opacity:1; cursor:default; }
.window.chatroom-app .chat-online-user { width:100%; padding:8px 0; border:0; background:transparent; color:var(--chat-text); text-align:left; }
.window.chatroom-app .chat-online-user:hover:not(:disabled) { background:#ffffff06; }
.chat-quote { display:flex; flex-direction:column; gap:2px; width:100%; margin:5px 0 7px; padding:7px 10px; border:0; border-left:2px solid #aabdd5; border-radius:0 6px 6px 0; background:#b8cbe40c; color:var(--chat-text-dim); text-align:left; }
.chat-quote strong { color:#c5d4e6; font:10px var(--chat-mono); }
.chat-quote span { display:-webkit-box; overflow:hidden; -webkit-box-orient:vertical; -webkit-line-clamp:2; line-clamp:2; white-space:pre-wrap; overflow-wrap:anywhere; font-size:11px; line-height:1.5; }
#chat-reply-preview { display:flex; align-items:center; gap:9px; margin:0 0 10px; padding:6px 8px; border-left:2px solid #b8cbe4; background:#b8cbe40b; }
#chat-reply-preview > div { flex:1; min-width:0; }
#chat-reply-preview strong,#chat-reply-preview span { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; }
#chat-reply-author { color:var(--chat-accent); font-weight:500; }
#chat-reply-text { color:var(--chat-text-dim); }
#chat-cancel-reply { flex:none; width:28px; height:28px; padding:0; border:0; border-radius:6px; background:transparent; color:var(--chat-text); font-size:20px; }
#chat-message-menu { position:absolute; z-index:15; width:180px; padding:5px; border:1px solid #ffffff25; border-radius:9px; background:#303945; box-shadow:0 9px 25px #0005; }
#chat-message-menu button { display:block; width:100%; padding:8px 10px; border:0; border-radius:5px; background:transparent; color:var(--chat-text); text-align:left; font-size:12px; }
#chat-message-menu button:hover,#chat-message-menu button:focus-visible { background:#ffffff0e; }
#chat-message-menu [data-chat-action="withdraw"] { color:#efbdc4; }
.window.chatroom-app .chat-withdrawn-text { color:var(--chat-text-dim); font-size:12px; font-style:italic; line-height:1.75; }
.chat-unread-divider { display:flex; align-items:center; gap:10px; margin:12px 0; color:#dba7b4; font-size:11px; }
.chat-unread-divider::before,.chat-unread-divider::after { content:""; flex:1; height:1px; background:#dba7b440; }
.chat-message-highlight { animation:chat-message-flash 1.6s ease; }
@keyframes chat-message-flash { from { background:#b8cbe42b; } to { background:transparent; } }
.chat-empty { color:var(--chat-text-dim); text-align:center; font-size:12px; padding:20px 0; }
.window.chatroom-app .chat-feature-dialog { width:min(440px,calc(100% - 32px)); max-height:calc(100dvh - 40px); box-sizing:border-box; margin:auto; overflow:auto; padding:22px; border:1px solid #ffffff25; border-radius:15px; background:#272e38; color:#e0e4eb; box-shadow:0 25px 90px #0006; color-scheme:dark; }
.chat-feature-dialog::backdrop { background:#0e1219cc; backdrop-filter:blur(5px); }
.chat-feature-dialog h2 { margin:0 0 14px; font-size:18px; font-weight:550; }
#chat-confirm-title { overflow-wrap:anywhere; }
#chat-confirm-text { font-size:12px; line-height:1.8; white-space:pre-wrap; overflow-wrap:anywhere; }
.chat-feature-dialog button { min-height:33px; padding:6px 11px; border:1px solid #ffffff20; border-radius:7px; color:#e0e4eb; background:#ffffff08; }
.chat-confirm-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:20px; }
#chat-confirm-ok { color:#253447; background:#b8cbe4; }
#chat-inbox-list { font-size:12px; line-height:1.7; }
.window.chatroom-app .chat-inbox-row { display:flex; width:100%; align-items:center; justify-content:space-between; gap:10px; margin:6px 0; padding:10px; text-align:left; }
.chat-inbox-row > span { overflow-wrap:anywhere; min-width:0; font:11px var(--chat-mono); }
.chat-inbox-row > b { flex:none; color:#efbdc4; }
.chat-privacy-note { margin:17px 0 0; color:#a1acba; font-size:10px; line-height:1.7; }
/* Match the direct-child image sizes in desktop.css without wrapping or changing the image. */
#desktop > [appname="chatroom-app"]:not(.choose) { position:relative; --chat-icon-half:32.5px; --chat-badge-top:-5px; }
#desktop > .b[appname="chatroom-app"] { --chat-icon-half:20px; --chat-badge-top:0px; }
#desktop > [appname="chatroom-app"]:not(.choose)[data-chat-unread] > .chat-desktop-unread { position:absolute; top:var(--chat-badge-top); right:calc(50% - var(--chat-icon-half) - 7px); z-index:2; display:grid; place-items:center; box-sizing:border-box; min-width:20px; height:20px; padding:0 4px; border:2px solid #1c2530; border-radius:20px; background:#d9304f; color:#fff; font:700 10px/1 "Segoe UI",Arial,sans-serif; font-variant-numeric:tabular-nums; box-shadow:0 2px 6px #0003; pointer-events:none; }
/* Keep the existing PC alignment; optically center mobile numerals without moving the badge. */
.chat-desktop-unread-number { display:block; }
@media (max-width:767px) {
    #desktop > [appname="chatroom-app"]:not(.choose) { --chat-icon-half:30px; }
    #desktop > .b[appname="chatroom-app"] { --chat-icon-half:26px; --chat-badge-top:-1px; }
    @supports (text-box-trim:trim-both) and (text-box-edge:cap alphabetic) {
        .chat-desktop-unread-number { text-box-trim:trim-both; text-box-edge:cap alphabetic; transform:translateY(-.4px); }
    }
}
@container chatroom (max-width:480px) {
    #chat-tabs { padding-left:14px; padding-right:14px; }
    .chat-room-header { flex-wrap:wrap; gap:6px; padding:9px 0; }
    .chat-header-actions { margin-left:auto; }
    #chat-room-kind { max-width:25ch; font-size:8px; }
    #chat-inbox-btn { font-size:10px; padding:5px 7px; }
    #chat-reply-preview strong,#chat-reply-preview span { font-size:10px; }
}
.window.chatroom-app.chat-opening > .content { opacity:0; pointer-events:none; }
.window.chatroom-app.chat-opening > .loadback { display:block; inset:38px 0 0; width:auto; height:auto; background:var(--chat-bg); pointer-events:none; }
.window.chatroom-app.chat-opening > .loadback > .icon { display:none; }
#chat-opening-indicator { display:none; }
.chat-opening #chat-opening-indicator { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:19px; }
.chat-loading-orbit { position:relative; display:grid; place-items:center; width:76px; height:76px; border-radius:50%; background:radial-gradient(circle,#b8cbe418,transparent 70%); }
.chat-loading-orbit::before,.chat-loading-orbit::after { content:""; position:absolute; inset:0; border:1px solid #b8cbe419; border-radius:50%; border-top-color:#c3d5ec; border-right-color:#b8cbe469; animation:chat-loading-orbit 2.4s linear infinite; }
.chat-loading-orbit::after { inset:7px; border-color:#c8b9df10; border-bottom-color:#c8b9dfb3; border-left-color:#c8b9df40; animation-duration:3.2s; animation-direction:reverse; }
.chat-loading-core { display:grid; place-items:center; width:48px; height:48px; border:1px solid #b8cbe41c; border-radius:16px; background:#b8cbe409; box-shadow:0 0 22px #b8cbe40b; }
.chat-loading-core > .icon { display:block; width:36px; height:36px; object-fit:contain; }
.chat-loading-label { color:var(--chat-text-dim); font-size:11px; line-height:1.5; letter-spacing:.6px; }
@keyframes chat-loading-orbit { to { transform:rotate(360deg); } }
@media(prefers-reduced-motion:reduce) {
    .chat-message-highlight { animation:none; outline:1px solid #b8cbe4; }
    .chat-loading-orbit::before,.chat-loading-orbit::after { animation:none; }
}
