/* The conversation fills its surface; the composer remains at its lower edge. */
html:root dialog#chat-panel{overflow:hidden}
html:root dialog#chat-panel>header{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px;padding:18px 22px 12px}
html:root dialog#chat-panel .chat-header-copy{min-width:0}
html:root dialog#chat-panel .chat-header-copy p{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:4px 0 0}
html:root dialog#chat-panel .chat-header-actions{position:static;display:flex;gap:8px;align-items:center}
html:root dialog#chat-panel .chat-toolbar{grid-column:1/-1;display:flex;gap:12px;align-items:center;min-width:0}
html:root dialog#chat-panel .chat-toolbar .chat-chime-toggle{position:static;inset:auto;height:auto;min-height:36px;width:auto;flex:none;padding:7px 12px;font-size:13px;opacity:1}
html:root dialog#chat-panel .chat-toolbar #chat-conversation{flex:1;width:auto;min-width:0;min-height:40px;font-size:16px;padding:8px 34px 8px 12px}
html:root dialog#chat-panel .chat-panel-body{flex:1;display:flex;flex-direction:column;min-height:0;overflow:hidden;padding:10px 22px 20px;gap:8px}
html:root dialog#chat-panel :is(#group-chat-section,#room-private-section):not([hidden]){display:flex;flex:1;flex-direction:column;min-height:0;overflow:hidden;margin:0;padding:0;border:0}
html:root dialog#chat-panel :is(.chat-heading-row h2,#chat-identity,.private-chat-intro,#room-private-section>h2){display:none}
html:root dialog#chat-panel .chat-heading-row{flex:none;display:flex;justify-content:flex-end;margin:0 0 6px;min-height:0}
html:root dialog#chat-panel .chat-updated{display:block;flex-basis:auto;font-size:12px}
html:root dialog#chat-panel :is(#chat-messages,#room-private-messages){flex:1;min-height:0;max-height:none;margin:0;padding:12px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none}
html:root dialog#chat-panel :is(#chat-form,#room-private-form):not([hidden]){flex:none;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 8px;align-items:end;padding:0;margin:14px 0 0}
html:root dialog#chat-panel form label{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
html:root dialog#chat-panel form textarea{box-sizing:border-box;width:100%;height:60px;min-height:60px;max-height:96px;margin:0;padding:10px 12px;resize:none;font-size:16px}
html:root dialog#chat-panel form button{margin:0;min-height:44px;padding:10px 14px}
html:root dialog#chat-panel .chat-typing{grid-column:1/-1;grid-row:2;height:16px;min-height:16px;margin:0;font-size:12px;line-height:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
/* Explicit tracks keep the composer fixed even while a cached client hides
   its typing element. Send must never fall into an automatically placed row. */
html:root dialog#chat-panel #chat-form{grid-template-rows:60px 16px}
html:root dialog#chat-panel #chat-form textarea{grid-column:1;grid-row:1}
html:root dialog#chat-panel #chat-form>button{grid-column:2;grid-row:1}
html:root dialog#chat-panel :is(#chat-status,#room-private-status){flex:none;margin:6px 0 0;min-height:0;font-size:13px}
html:root dialog#chat-panel :is(#chat-status,#room-private-status):empty{display:none}
html:root dialog#chat-panel .chat-retry:not([hidden]){align-self:flex-end;flex:none}
html:root dialog#chat-panel .chat-message p{font-size:16px;line-height:1.45}
html:root dialog#chat-panel .chat-message strong{font-size:14px}
html:root dialog#chat-panel .chat-scroll-cue{flex:none;font-size:12px;margin:6px auto 0}
@media(max-width:600px){
 html:root dialog#chat-panel,html.pwa-mode:root dialog#chat-panel[open]{height:min(56svh,var(--chat-viewport-height,100dvh));max-height:min(56svh,var(--chat-viewport-height,100dvh))}
 html:root dialog#chat-panel>header{padding:max(10px,env(safe-area-inset-top)) 14px 8px;gap:8px}
 html:root dialog#chat-panel .chat-header-copy h1{font-size:22px;white-space:normal}
 html:root dialog#chat-panel .chat-panel-body{padding:8px 14px 14px}
 html:root dialog#chat-panel :is(#chat-messages,#room-private-messages){padding:8px}
 html:root dialog#chat-panel :is(#chat-form,#room-private-form){margin-top:10px}
 html:root dialog#chat-panel form textarea{height:48px;min-height:48px}
 html:root dialog#chat-panel #chat-form{grid-template-rows:48px 16px}
 html:root dialog#chat-panel .chat-message{padding:6px 0}
 html:root dialog#chat-panel .chat-message p{font-size:15px}
}
