body.app-ui.chat-page main{max-width:1240px;width:calc(100% - 48px);padding:0;margin:24px auto;border:1px solid #e3e8f3;border-radius:18px;overflow:hidden;background:white}.chat-layout{display:grid;grid-template-columns:260px minmax(0,1fr);height:calc(100dvh - 140px);min-height:520px;max-height:880px}.chat-sidebar{background:#f8f9fd;border-right:1px solid #e5e9f4;display:flex;flex-direction:column;min-height:0}.chat-sidebar-title{padding:25px 24px 18px}.chat-sidebar-title .eyebrow{font-size:8px;letter-spacing:1.8px}.chat-page .chat-sidebar-title h1{font-size:24px;margin:9px 0!important;letter-spacing:-1px}.chat-sidebar-title p{font-size:11px;color:#96a0b7;margin:0}.chat-search{padding:0 18px 16px;display:block}.chat-search>span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}body.app-ui .chat-search input{width:100%;font-size:12px;min-height:38px;background:#fff;border-color:#e4e8f2}.chat-sidebar nav{overflow-y:auto;padding:0 10px 15px;min-height:0;flex:1;scrollbar-width:thin}.chat-room-button{display:flex!important;align-items:center;gap:10px;width:100%;text-align:left;border:0!important;background:transparent!important;border-radius:9px!important;padding:12px!important;color:#6c7a96!important;min-height:52px!important;margin-bottom:3px}.chat-room-button>span{font-size:11px;background:#eef1f9;color:#8c9abc;width:30px;height:30px;display:flex;align-items:center;justify-content:center;border-radius:9px;flex-shrink:0}.chat-room-button>strong{font-size:12px;font-weight:500;overflow-wrap:anywhere}.chat-room-button.selected{background:#e9edff!important;color:#4c61d6!important}.chat-room-button.selected>span{background:#6376df;color:white}.chat-sidebar-foot{padding:16px 22px;border-top:1px solid #e7ebf5;font-size:10px;flex-shrink:0}.chat-sidebar-foot a{display:block;margin-bottom:8px}.chat-sidebar-foot p{color:#a3aec2;font-size:9px}.chat-conversation{display:flex;flex-direction:column;min-width:0;min-height:0;position:relative}.chat-heading{padding:22px 28px 16px;border-bottom:1px solid #eef0f7;display:flex;align-items:center;justify-content:space-between;gap:12px}.chat-room-kicker{font-size:8px;color:#a1acc3;letter-spacing:1.6px}.chat-page .chat-heading h2{font-size:20px;margin:6px 0!important;line-height:1.4}.chat-heading p{font-size:10px;color:#95a1b8;margin:0;line-height:1.8;max-width:580px}.chat-mobile-picker{display:none}.chat-join{padding:12px 28px;display:flex;align-items:center;gap:10px;background:#fafbff;border-bottom:1px solid #eff1f7;flex-wrap:wrap}.chat-join>label:not(.chat-trap){display:flex;align-items:center;gap:10px;font-size:10px;min-width:0}.chat-join input#chat-nickname{font-size:12px;min-height:36px;width:210px;padding:8px 10px;border-color:#e2e7f3}.chat-join input:read-only{background:#f0f3fa!important;color:#71809e}.chat-join>button{font-size:11px!important;padding:7px 14px!important;min-height:36px!important;background:#5267da!important;color:white!important;border-color:#5267da!important}.chat-join>span{font-size:9px;color:#99a4ba}.chat-trap{position:absolute!important;width:1px!important;height:1px!important;overflow:hidden;clip-path:inset(50%);left:-9999px}.chat-connection{padding:8px 28px;margin:0;font-size:9px;color:#9da9bf;background:#fff;flex-shrink:0}.chat-stream{overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;flex:1;min-height:0;padding:12px 28px 24px;background:#fbfcff}.chat-empty{text-align:center;font-size:12px;color:#a4afc4;margin:35px 0;line-height:1.9}.chat-message{max-width:86%;margin-bottom:20px}.chat-message.mine{margin-left:auto}.chat-message-meta{display:flex;align-items:center;gap:8px;font-size:10px;margin-bottom:6px;flex-wrap:wrap}.chat-message-meta strong{font-weight:600;color:#7c8ba8}.chat-message-meta time{font-size:8px;color:#aeb7cb}.chat-message.mine .chat-message-meta{justify-content:flex-end}.chat-moderator-badge{font-size:8px;background:#eef0ff;color:#6275d0;border:1px solid #dde3ff;padding:1px 5px;border-radius:4px}.chat-message-body{background:white;border:1px solid #e7ebf5;padding:11px 14px;font-size:13px;line-height:1.8;color:#4a5976;border-radius:0 12px 12px 12px;white-space:pre-wrap;overflow-wrap:anywhere}.chat-message.mine .chat-message-body{background:#eff2ff;border-color:#e0e6ff;border-radius:12px 0 12px 12px}.chat-message.pending .chat-message-body{background:#fffaf0;border-color:#eee1c6}.chat-message.rejected .chat-message-body{background:#f8f4f3;color:#a88a81;border-color:#eadeda}.chat-message-actions{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin-top:5px}.chat-message-actions>span{font-size:9px;color:#b09b71}.chat-message-actions button{border:0!important;background:transparent!important;padding:2px 0!important;min-height:26px!important;font-size:9px!important;color:#a5b0c6!important}.chat-message.mine .chat-message-actions{justify-content:flex-end}.chat-compose{padding:14px 24px 12px;background:white;border-top:1px solid #e7ebf5;flex-shrink:0}.chat-compose textarea{resize:vertical;max-height:180px;width:100%;min-height:64px!important;border:0!important;padding:8px 4px!important;font-size:14px!important;background:white!important;color:#394b70}.chat-compose textarea:focus-visible{outline:0!important;box-shadow:inset 0 -2px 0 #7c8ee5}.chat-compose-bottom{display:flex;align-items:center;gap:12px}.chat-compose-bottom>span:first-child{font-size:9px;color:#a1adc2;margin-right:auto}.chat-compose-bottom>span:nth-child(2){font-size:9px;color:#b4bed0;white-space:nowrap}.chat-compose-bottom>button{background:#5267da!important;color:white!important;padding:8px 18px!important;font-size:12px!important;min-height:36px!important;border-color:#5267da!important}.chat-compose>#chat-status{font-size:10px;line-height:1.6;color:#8d9ab4;margin:8px 0 0;min-height:0}.chat-compose>#chat-status:empty{display:none}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}#chat-new-messages{position:absolute;bottom:155px;right:24px;font-size:10px;padding:8px 14px;min-height:34px;background:#ecf0ff;border:1px solid #d7dfff;color:#5369c9;box-shadow:0 4px 20px #354c9417}
@media(max-width:1000px){.chat-layout{grid-template-columns:210px minmax(0,1fr)}.chat-sidebar-title{padding:22px 18px 18px}.chat-join{padding:12px 20px}.chat-join input#chat-nickname{width:160px}.chat-join>span{flex-basis:100%}.chat-heading{padding:18px 20px}.chat-stream{padding-left:20px;padding-right:20px}}
@media(max-width:700px){body.app-ui.chat-page main{width:calc(100% - 20px);margin:12px auto;border-radius:14px}.chat-layout{grid-template-columns:minmax(0,1fr);height:calc(100dvh - 174px);min-height:420px;max-height:none}.chat-sidebar{display:none}.chat-heading{padding:14px 15px 12px;align-items:flex-start}.chat-page .chat-heading h2{font-size:18px;margin:5px 0!important}.chat-heading p{font-size:9px;max-width:230px}.chat-room-kicker{font-size:7px}.chat-mobile-picker{display:flex;flex-direction:column;gap:4px;font-size:8px!important;max-width:135px;flex-shrink:0}.chat-mobile-picker select{font-size:12px!important;padding:7px 8px!important;min-height:36px!important;max-width:135px}.chat-join{padding:10px 14px;gap:8px}.chat-join>label:not(.chat-trap){font-size:9px;gap:8px;flex:1}.chat-join input#chat-nickname{min-width:0;width:100%;font-size:16px;min-height:36px}.chat-join>span{display:none}.chat-join>button{padding:7px 10px!important;font-size:10px!important}.chat-connection{padding:7px 15px;font-size:8px}.chat-stream{padding:10px 15px 16px}.chat-message{max-width:93%;margin-bottom:16px}.chat-message-body{font-size:13px;padding:10px 12px}.chat-message-meta strong{font-size:10px}.chat-message-actions button{min-height:30px!important}.chat-compose{padding:10px 13px}.chat-compose textarea{font-size:16px!important;min-height:56px!important;max-height:110px;resize:none}.chat-compose-bottom{gap:8px}.chat-compose-bottom>span:first-child{font-size:8px;max-width:65%;line-height:1.7}.chat-compose-bottom>span:nth-child(2){display:none}.chat-compose-bottom>button{font-size:11px!important;min-height:36px!important;padding:8px 15px!important}.chat-page .header-action{display:none!important}#chat-new-messages{right:15px;bottom:130px;font-size:9px}.chat-empty{font-size:11px;margin:24px 0}}
@media(max-height:650px) and (max-width:700px){.chat-layout{min-height:280px}.chat-heading p,.chat-room-kicker,.chat-connection{display:none}.chat-heading{padding:10px 14px}.chat-join{padding:7px 12px}}
.chat-heading>div{min-width:0}.chat-heading h2,.chat-heading p{overflow-wrap:anywhere}
@media(max-width:700px){.chat-message-body{font-size:14px}.chat-compose-bottom>span:first-child{font-size:10px;color:#71819b;max-width:68%}.chat-compose>#chat-status{font-size:12px;color:#667590}.chat-join>button{min-height:42px!important;font-size:11px!important}.chat-compose-bottom>button{min-height:42px!important}.chat-connection{font-size:9px;color:#7b89a3}.chat-message-actions button{min-height:34px!important;font-size:10px!important}}

body.chat-embedded{padding:0!important;background:#fff}body.chat-embedded #page-content{margin:0!important;padding:0!important;width:100%!important;max-width:none!important}.chat-embedded .chat-sidebar{display:none}.chat-embedded .chat-layout{display:block;margin:0;border:0;height:100dvh;border-radius:0}.chat-embedded .chat-conversation{height:100%;min-height:0}.chat-embedded .chat-mobile-picker{display:block}.chat-embedded .chat-heading{padding:12px}.chat-embedded .chat-heading h2{font-size:16px}.chat-embedded .chat-heading p,.chat-embedded .chat-room-kicker{display:none}.chat-embedded .chat-join{padding:10px}.chat-embedded .chat-stream{min-height:70px}.chat-embedded .chat-compose{padding:10px}.chat-embedded .chat-compose-bottom{flex-wrap:wrap}

.chat-embedded .chat-layout{min-height:0;max-height:none}.chat-embedded input#chat-nickname{width:150px!important}.chat-embedded .chat-compose textarea{min-height:48px;height:48px}

/* Compact conversation chrome: keep the message stream dominant. */
.chat-heading{padding:12px 18px}.chat-heading p{color:#536176}.chat-room-kicker{display:none}.chat-join{padding:8px 18px;gap:8px}.chat-join>span{font-size:11px;color:#526176}.chat-joined .chat-join{display:none}.chat-stream{background:#fff;padding:12px 16px}.chat-message{margin-bottom:13px}.chat-message-meta{color:#46546b!important}.chat-message-body{color:#182338!important;background:#f1f4f9;border-color:#d5deeb;line-height:1.6}.chat-message.mine .chat-message-body{background:#eaf0ff;border-color:#c9d7f6;color:#152f66}.chat-compose{padding:10px 14px;border-top:1px solid #cdd6e4}.chat-compose textarea{font-size:14px!important;min-height:48px!important;height:48px;line-height:1.5;color:#152338}.chat-compose-bottom{margin-top:6px!important;gap:6px}.chat-compose-bottom>button{min-height:34px!important;padding:7px 14px!important}.chat-compose-bottom>span:first-child{font-size:10px!important;color:#4c5d76!important}#chat-status{margin:5px 0 0!important;font-size:11px!important;color:#47566c!important}.chat-connection{color:#526176;padding:5px 16px}.chat-embedded #page-content{border:0!important;min-height:0!important;height:100dvh;overflow:hidden!important}.chat-embedded .chat-layout{height:100%;min-height:0!important}.chat-embedded .chat-heading{padding:6px 10px;min-height:32px;box-sizing:content-box;background:#f4f7fc;flex-shrink:0}.chat-embedded .chat-heading h2{display:none}.chat-embedded .chat-mobile-picker{display:flex;align-items:center;gap:6px;font-size:0;margin-left:auto;width:100%}.chat-embedded .chat-mobile-picker select{font-size:12px!important;min-height:32px!important;padding:5px 9px!important;width:100%;background:#fff}.chat-embedded .chat-join{padding:6px 10px;flex-wrap:nowrap;flex-shrink:0}.chat-embedded .chat-join>label:not(.chat-trap){font-size:0;flex:1}.chat-embedded input#chat-nickname{width:100%!important;min-height:32px!important;font-size:12px!important;padding:6px 8px!important}.chat-embedded .chat-join>button{font-size:11px!important;min-height:32px!important;white-space:nowrap;padding:5px 9px!important}.chat-embedded #chat-identity{display:none}.chat-embedded .chat-connection{padding:3px 10px;font-size:9px}.chat-embedded .chat-stream{padding:8px 10px;min-height:0!important}.chat-embedded .chat-message-body{font-size:13px;padding:8px 10px}.chat-embedded .chat-compose{padding:7px 10px;flex-shrink:0}.chat-embedded .chat-compose textarea{min-height:36px!important;height:36px;font-size:13px!important;padding:7px 8px!important}.chat-embedded .chat-compose-bottom{flex-wrap:nowrap}.chat-embedded .chat-compose-bottom>span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}.chat-embedded #chat-length{display:none}.chat-embedded #chat-status:empty{display:none}.chat-embedded .chat-empty{margin:15px 0;font-size:11px;color:#55647b}.chat-embedded .chat-message-actions button{font-size:10px!important;min-height:26px!important}

.chat-embedded .chat-heading>div{display:none}.chat-embedded .chat-mobile-picker{max-width:none!important;font-size:0!important;flex-direction:row;width:100%!important;margin:0}.chat-embedded .chat-mobile-picker select{max-width:none!important;width:100%!important}.chat-embedded .chat-heading{min-height:0}.chat-embedded.chat-joined .chat-heading{padding:5px 10px}

.chat-room-tabs{display:none;min-width:0;gap:6px;align-items:center;overflow-x:auto;scrollbar-width:thin;-webkit-overflow-scrolling:touch}.chat-room-tabs .chat-room-tab{flex:0 0 auto;white-space:nowrap;padding:7px 12px!important;min-height:34px!important;border:1px solid #c7d3e5!important;border-radius:7px!important;background:#fff!important;color:#405775!important;font-size:12px!important;line-height:1.2}.chat-room-tabs .chat-room-tab[aria-pressed=true]{background:#2454b8!important;border-color:#2454b8!important;color:white!important}.chat-embedded .chat-room-tabs{display:flex;flex:1;width:100%;max-width:100%}.chat-embedded .chat-heading{padding:6px 8px;display:flex}.chat-embedded .chat-heading .chat-room-tab{font-size:11px!important;min-height:32px!important;padding:6px 10px!important}.chat-embedded .chat-heading>div{display:none}@media(max-width:700px){.chat-room-tabs{display:flex;width:100%}.chat-heading{flex-wrap:wrap}.chat-heading>div{display:none}.chat-embedded .chat-heading{flex-wrap:nowrap}}
/* Reserve remaining panel height for messages instead of content-driven flex sizing. */
.chat-embedded .chat-conversation{display:grid;height:100%!important;min-height:0;grid-template-rows:auto auto auto minmax(0,1fr) auto auto}
.chat-embedded .chat-heading{grid-row:1}.chat-embedded .chat-join{grid-row:2}.chat-embedded .chat-connection{grid-row:3}.chat-embedded .chat-stream{grid-row:4;overflow-y:auto;min-height:0;margin:0}.chat-embedded #chat-new-messages{grid-row:5}.chat-embedded .chat-compose{grid-row:6;min-height:0;margin:0}.chat-embedded .chat-compose textarea{resize:none;max-height:72px}.chat-embedded .chat-layout{overflow:hidden}
/* Conversation typography and spacing use the same hierarchy on every screen. */
body.app-ui.chat-page .chat-conversation{display:grid;grid-template-rows:auto auto auto minmax(0,1fr) auto auto}
body.app-ui.chat-page .chat-heading{grid-row:1;padding:10px 14px}
body.app-ui.chat-page .chat-join{grid-row:2;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:9px;padding:10px 14px}
body.app-ui.chat-page.chat-joined .chat-join{display:none}
body.app-ui.chat-page .chat-join>label:not(.chat-trap){display:flex;align-items:center;min-width:0;gap:8px;font-size:12px}
body.app-ui.chat-page .chat-nickname-label{flex:0 0 auto;white-space:nowrap;font-size:12px;color:#5a6b82}
body.app-ui.chat-page #chat-nickname{width:100%!important;min-width:0;min-height:38px;height:38px;font-size:14px!important;padding:8px 10px!important;box-sizing:border-box}
body.app-ui.chat-page #chat-nickname::placeholder{font-size:13px;color:#78879c;opacity:1}
body.app-ui.chat-page .chat-join>#chat-identity{display:none}
body.app-ui.chat-page #chat-join-button{height:38px;min-height:38px!important;white-space:nowrap;font-size:13px!important;padding:8px 12px!important}
body.app-ui.chat-page .chat-connection{grid-row:3;margin:0;font-size:11px!important;line-height:1.5;padding:6px 14px;color:#5a6b82}
body.app-ui.chat-page .chat-stream{grid-row:4;min-height:0;padding:14px;overflow-y:auto}
body.app-ui.chat-page #chat-new-messages{grid-row:5}
body.app-ui.chat-page .chat-message{width:fit-content;min-width:0;max-width:90%;margin-bottom:18px}
body.app-ui.chat-page .chat-message-meta{gap:6px;margin-bottom:5px;line-height:1.5;align-items:center}
body.app-ui.chat-page .chat-message-meta strong{font-size:12px;font-weight:600;color:#4d6079}
body.app-ui.chat-page .chat-message-meta time{font-size:11px;color:#7b899b}
body.app-ui.chat-page .chat-moderator-badge{font-size:10px;line-height:16px;padding:0 5px;border-radius:4px;color:#1565c0!important;background:#e3effc!important;border-color:#cbdff7!important}
body.app-ui.chat-page .chat-message-body{width:fit-content;max-width:100%;box-sizing:border-box;font-size:14px!important;line-height:1.65;padding:9px 12px;border-radius:0 10px 10px 10px}
body.app-ui.chat-page .chat-message.mine .chat-message-body{margin-left:auto;border-radius:10px 0 10px 10px}
body.app-ui.chat-page .chat-message-actions{margin-top:3px;gap:10px}
body.app-ui.chat-page .chat-message-actions button{font-size:11px!important;min-height:24px!important;padding:1px 0!important;color:#6c7e94!important}
body.app-ui.chat-page .chat-compose{grid-row:6;margin:0;padding:9px 14px;min-height:0}
body.app-ui.chat-page .chat-compose textarea{font-size:14px!important;line-height:1.6;min-height:40px!important;height:40px!important;padding:6px 0!important;resize:none}
body.app-ui.chat-page .chat-compose textarea::placeholder{font-size:13px;color:#78879c;opacity:1}
body.app-ui.chat-page .chat-compose-bottom{margin-top:5px!important;gap:8px;align-items:center}
body.app-ui.chat-page .chat-compose-bottom>span:first-child,body.app-ui.chat-page #chat-status{font-size:11px!important;line-height:1.5!important;color:#5a6b82!important}
body.app-ui.chat-page #chat-length{font-size:11px;color:#7b899b}
body.app-ui.chat-page #chat-send{font-size:13px!important;min-height:34px!important;padding:7px 13px!important}
body.app-ui.chat-page #chat-status:empty{display:none}
body.app-ui.chat-page .chat-room-tabs .chat-room-tab{font-size:13px!important;min-height:34px!important}
body.app-ui.chat-page .chat-empty{font-size:12px!important;color:#5a6b82}
@media(max-width:700px){body.app-ui.chat-page:not(.chat-embedded) .chat-layout{height:calc(100dvh - 164px);min-height:320px}body.app-ui.chat-page .chat-message{max-width:94%}body.app-ui.chat-page .chat-heading{padding:9px 12px}body.app-ui.chat-page .chat-join{padding:9px 12px;gap:8px}body.app-ui.chat-page .chat-stream{padding:12px}body.app-ui.chat-page .chat-connection{padding:5px 12px;font-size:10px!important}body.app-ui.chat-page .chat-compose{padding:8px 12px}}
body.app-ui.chat-embedded .chat-nickname-label{display:none}body.app-ui.chat-embedded .chat-heading{padding:6px 8px}body.app-ui.chat-embedded .chat-join{padding:6px 10px}body.app-ui.chat-embedded .chat-stream{padding:10px}body.app-ui.chat-embedded #chat-nickname,body.app-ui.chat-embedded #chat-join-button{height:34px;min-height:34px!important}body.app-ui.chat-embedded .chat-compose{padding:7px 10px}body.app-ui.chat-embedded .chat-message{margin-bottom:12px}
@supports(-webkit-touch-callout:none){body.app-ui.chat-page #chat-nickname,body.app-ui.chat-page .chat-compose textarea{font-size:16px!important}}
body.app-ui.chat-page .chat-room-tab[aria-pressed=true]{background:#1565c0!important;border-color:#1565c0!important}
body.app-ui.chat-page .chat-message-meta .chat-message-actions{display:inline-flex;align-items:center;gap:8px;margin:0;line-height:1.5}
body.app-ui.chat-page .chat-message-meta .chat-message-actions button{min-height:20px!important;line-height:18px;padding:0!important;font-size:10px!important}
body.app-ui.chat-page .chat-message-meta .chat-message-actions>span{font-size:11px}
.chat-message-meta{flex-wrap:wrap;gap:5px 7px}
.chat-member-number{font-size:10px;color:#71839b;font-variant-numeric:tabular-nums}
.chat-level-badge{display:inline-flex;align-items:center;border:1px solid #cfe0f3;border-radius:5px;padding:1px 5px;color:#38678e;background:#eff6fc;font-size:10px;line-height:17px;white-space:nowrap;font-weight:600}
.chat-level-badge.level-2{color:#17796e;background:#e9f7f2;border-color:#bae3d7}.chat-level-badge.level-3{color:#6553a1;background:#f2edfc;border-color:#d9cef0}.chat-level-badge.level-4{color:#97641c;background:#fff5df;border-color:#efdcaa}.chat-level-badge.level-5{color:#a64d3b;background:#fff0e9;border-color:#efcaba}.chat-level-badge.level-6{color:#875a11;background:linear-gradient(110deg,#fff8df,#f7e5b5);border-color:#dcbf75}
.chat-member-manage{font-size:10px;color:#1565c0;text-decoration:none}.chat-member-manage:hover{text-decoration:underline}
@media(max-width:600px){.chat-message-meta{gap:3px 5px}.chat-message-meta strong{font-size:12px}.chat-level-badge{font-size:9px;padding:0 4px}.chat-member-number{font-size:9px}}
/* 已加入当前房间后让出空间；切换房间或凭证失效时恢复加入表单。 */
html body.app-ui.chat-page main#page-content form#chat-join[hidden],html body.app-ui.chat-page.chat-joined main#page-content form#chat-join{display:none!important}

/* Two status rows must not auto-place into a second conversation column. */
html body.app-ui.chat-page .chat-conversation{grid-template-columns:minmax(0,1fr);grid-template-rows:auto auto auto auto minmax(0,1fr) auto auto}
html body.app-ui.chat-page .chat-conversation> *{grid-column:1;min-width:0}
html body.app-ui.chat-page #chat-sound-status{grid-row:3}
html body.app-ui.chat-page #chat-sound-status:empty{display:none}
html body.app-ui.chat-page #chat-connection{grid-row:4}
html body.app-ui.chat-page #chat-stream{grid-row:5}
html body.app-ui.chat-page #chat-new-messages{grid-row:6}
html body.app-ui.chat-page #chat-compose{grid-row:7}
/* Reserve header and dock space; only messages scroll, never behind Send. */
@media(max-width:700px){
html body.app-ui.chat-page:not(.chat-embedded) main#page-content{display:flex!important;flex-direction:column;box-sizing:border-box;height:calc(100dvh - 157px - env(safe-area-inset-bottom));min-height:0!important;margin-top:10px!important;margin-bottom:10px!important}
html body.app-ui.chat-page:not(.chat-embedded) .community-mobile-switch{flex:0 0 auto;padding:0!important;min-height:44px}
html body.app-ui.chat-page:not(.chat-embedded) .chat-layout{flex:1;min-height:0!important;height:auto!important;overflow:hidden}
html body.app-ui.chat-page #community-support-panel iframe{min-height:0!important}
}
/* Keep swipeable room buttons without a visible scrollbar track. */
.chat-room-tabs{scrollbar-width:none!important}
.chat-room-tabs::-webkit-scrollbar{display:none;width:0;height:0}

#chat-auth-links{grid-column:1/-1;margin:0;padding:10px 12px;background:#edf4ff;border-radius:8px;font-size:13px;line-height:1.7}#chat-auth-links a{display:inline-block;margin-right:12px;font-weight:600}#chat-auth-links[hidden]{display:none!important}

/* Two steps: select from every open room, then enter the conversation. */
html body.app-ui.chat-page:not(.chat-joined) .chat-sidebar,
html body.app-ui.chat-page:not(.chat-joined) #chat-stream,
html body.app-ui.chat-page:not(.chat-joined) #chat-compose,
html body.app-ui.chat-page:not(.chat-joined) .chat-connection,
html body.app-ui.chat-page:not(.chat-joined) #chat-new-messages{display:none!important}
html body.app-ui.chat-page:not(.chat-joined) .chat-layout{display:block!important;overflow-y:auto!important}
html body.app-ui.chat-page:not(.chat-joined) .chat-conversation{display:flex!important;min-height:100%;height:auto!important}
html body.app-ui.chat-page:not(.chat-joined) .chat-heading{display:block!important;padding:18px!important}
html body.app-ui.chat-page:not(.chat-joined) .chat-heading>div{display:none!important}
html body.app-ui.chat-page:not(.chat-joined) #chat-room-picker{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;overflow:visible!important;white-space:normal!important;margin-top:0;max-height:none!important}
html body.app-ui.chat-page:not(.chat-joined) #chat-room-picker button{white-space:normal!important;min-height:48px!important;margin:0!important;width:100%;padding:10px!important}
html body.app-ui.chat-page:not(.chat-joined) #chat-join{display:flex!important;flex-direction:column;align-items:stretch;padding:0 18px 18px!important;background:white;border:0}
html body.app-ui.chat-page #chat-join-button{width:100%;min-height:44px!important;font-size:15px!important}
html body.app-ui.chat-page #chat-entry-status{font-size:13px;margin:0;color:#61758e}
html body.app-ui.chat-page #chat-identity[hidden],html body.app-ui.chat-page #chat-back-rooms[hidden]{display:none!important}
html body.app-ui.chat-page.chat-joined #chat-room-picker{display:none!important}
html body.app-ui.chat-page.chat-joined #chat-back-rooms{display:block;font-size:12px;white-space:nowrap;padding:8px 12px}
html body.app-ui.chat-page.chat-joined .chat-heading{display:flex!important}
html body.app-ui.chat-page.chat-joined .chat-heading>div{display:block!important}
@media(min-width:520px){html body.app-ui.chat-page:not(.chat-joined) #chat-room-picker{grid-template-columns:repeat(4,minmax(0,1fr))}}

html body.app-ui.chat-page main#page-content .chat-heading #chat-room-name{display:block!important;font-size:16px!important;line-height:1.4;margin:0!important}
html body.app-ui.chat-page main#page-content #chat-room-picker .chat-room-tab{font-size:14px!important}
html body.app-ui.chat-page main#page-content #chat-join #chat-join-button{height:44px;min-height:44px!important;font-size:15px!important}

@media(max-width:519px){html body.app-ui.chat-page:not(.chat-joined) main#page-content #chat-room-picker .chat-room-tab{font-size:13px!important;line-height:1.4;padding:8px 5px!important;overflow-wrap:anywhere}}

/* Keep the entry action at the bottom; only the room list scrolls. */
html body.app-ui.chat-page:not(.chat-joined) main#page-content .chat-layout{overflow:hidden!important}
html body.app-ui.chat-page:not(.chat-joined) main#page-content .chat-conversation{height:100%!important;min-height:0!important;display:flex!important;flex-direction:column}
html body.app-ui.chat-page:not(.chat-joined) main#page-content .chat-heading{flex:1 1 0;min-height:0;overflow-y:auto;overscroll-behavior:contain;box-sizing:border-box}
html body.app-ui.chat-page:not(.chat-joined) main#page-content .chat-heading .chat-room-instruction{display:block!important;font-size:15px!important;font-weight:600;color:#243954;line-height:1.5;margin:0 0 14px!important;max-width:none}
html body.app-ui.chat-page.chat-joined main#page-content .chat-room-instruction{display:none!important}
html body.app-ui.chat-page:not(.chat-joined) main#page-content form#chat-join{flex:0 0 auto;margin-top:auto;padding:12px 12px calc(12px + env(safe-area-inset-bottom))!important;border-top:1px solid #dce5f1;background:#f4f7fc;box-sizing:border-box}

html body.app-ui.chat-page main#page-content .chat-login-gate{display:flex;flex:1;align-items:center;justify-content:center;padding:28px 20px;box-sizing:border-box;background:#f6f8fc}
html body.app-ui.chat-page .chat-login-card{width:100%;max-width:340px;text-align:center}
html body.app-ui.chat-page .chat-login-card h1{font-size:22px!important;line-height:1.4;margin:0 0 12px!important;color:#203754}
html body.app-ui.chat-page .chat-login-card p{font-size:14px!important;line-height:1.8;color:#65788e;margin:0 0 26px}
html body.app-ui.chat-page .chat-login-card a{display:block;text-decoration:none;font-size:15px!important;line-height:24px;border-radius:10px;padding:12px}
html body.app-ui.chat-page .chat-login-card .chat-login-primary{color:#fff;background:#1764bd;font-weight:600}
html body.app-ui.chat-page .chat-login-card .chat-login-register{color:#1764bd;margin-top:10px}

/* Explicit hidden state wins over the room-selection flex layout. */
html body.app-ui.chat-page main#page-content .chat-conversation[hidden]{display:none!important}
html body.app-ui.chat-page main#page-content #community-support-panel[hidden]{display:none!important}

/* Room switching lives in the top mode control after joining. */
html body.app-ui.chat-page.chat-joined main#page-content .chat-heading{display:none!important}

html body.app-ui.chat-page.chat-joined:not(.chat-embedded) main#page-content>.community-mobile-switch{display:flex!important;gap:0;flex-shrink:0}html body.app-ui.chat-page.chat-joined .community-mobile-switch button{flex:1}

html body.app-ui.chat-page main#page-content #chat-sound-status,html body.app-ui.chat-page main#page-content #chat-connection,html body.app-ui.chat-page main#page-content #chat-status[hidden]{display:none!important}

/* Server-selected single room stays in the conversation even while joining. */
html body.app-ui.chat-page.chat-single-entry .chat-sidebar{display:none!important}
html body.app-ui.chat-page.chat-single-entry .chat-layout{grid-template-columns:minmax(0,1fr)}
html body.app-ui.chat-page.chat-single-entry #chat-join[hidden]{display:none!important}
