/* RoiKib Chat Keyboard Dock v1.0.7
   Scope: mobile chat only. Anchor chat viewport bottom at visualViewport.offsetTop + visualViewport.height, not height alone.
   Keep composer visible, bubble positions stable, and preserve browser zoom accessibility.
*/
@media (max-width:700px) {
  html:has(body.rk-chat-keyboard-v107) {
    width:100%; max-width:100%; height:100%; overflow:hidden;
    overscroll-behavior:none;
  }
  body.rk-chat-keyboard-v107 {
    position:fixed!important; top:0!important; left:0!important;
    right:0!important; bottom:auto!important; transform:none!important;
    display:flex; flex-direction:column;
    width:100%!important; max-width:100%!important;
    min-width:0; min-height:0!important;
    height:var(--rk-v107-bottom, 100dvh)!important;
    max-height:var(--rk-v107-bottom, 100dvh)!important;
    padding:0; margin:0; overflow:hidden; overscroll-behavior:none;
  }
  body.rk-chat-keyboard-v107 > .topbar {flex:0 0 auto; min-width:0; max-width:100%;}
  body.rk-chat-keyboard-v107 .top-inner {min-width:0; max-width:100%;}
  body.rk-chat-keyboard-v107 .chat-layout {
    display:block; flex:1 1 0%; width:100%; max-width:100%;
    min-width:0; min-height:0; height:auto!important;
    margin:0; border:0; overflow:hidden;
  }
  body.rk-chat-keyboard-v107 .chat-sidebar,
  body.rk-chat-keyboard-v107 .conversation,
  body.rk-chat-keyboard-v107 .active-conversation {
    width:100%; max-width:100%; min-width:0; min-height:0;
    height:100%; overflow:hidden;
  }
  body.rk-chat-keyboard-v107 .chat-layout.show-conversation .conversation {display:flex;}
  body.rk-chat-keyboard-v107 .active-conversation {display:flex; flex-direction:column;}
  body.rk-chat-keyboard-v107 .conversation-top,
  body.rk-chat-keyboard-v107 .composer,
  body.rk-chat-keyboard-v107 .composer-hint {
    flex:0 0 auto; width:100%; max-width:100%; min-width:0;
  }
  body.rk-chat-keyboard-v107 .messages {
    flex:1 1 0%; width:100%; max-width:100%; min-width:0; min-height:0;
    overflow-x:hidden; overflow-y:auto;
    overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
  }
  body.rk-chat-keyboard-v107 .bubble-list {display:flex; flex-direction:column; width:100%; max-width:100%; min-width:0;}
  body.rk-chat-keyboard-v107 .bubble {
    box-sizing:border-box; min-width:0; width:fit-content;
    max-width:min(85%,490px); overflow-wrap:anywhere; word-break:break-word;
  }
  body.rk-chat-keyboard-v107 .bubble.mine {max-width:min(85%,490px); align-self:flex-end; margin-left:auto; margin-right:0;}
  body.rk-chat-keyboard-v107 .rk-chat-message-row {
    display:flex; align-items:flex-end; flex-shrink:0;
    width:fit-content; max-width:100%; min-width:0; align-self:flex-start;
  }
  body.rk-chat-keyboard-v107 .rk-chat-message-row > .bubble {
    min-width:0; max-width:calc(100% - 38px); flex:0 1 auto;
  }
  body.rk-chat-keyboard-v107 .composer {
    display:flex; align-items:flex-end; gap:7px;
    padding:9px 9px calc(7px + env(safe-area-inset-bottom, 0px));
  }
  body.rk-chat-keyboard-v107.rk-v107-keyboard .composer {padding-bottom:7px;}
  body.rk-chat-keyboard-v107 .composer textarea,
  body.rk-chat-keyboard-v107 #memberQuery,
  body.rk-chat-keyboard-v107 input[type=text],
  body.rk-chat-keyboard-v107 input[type=search] {
    font-size:16px!important; -webkit-text-size-adjust:100%;
  }
  body.rk-chat-keyboard-v107 .composer textarea {
    flex:1 1 0%; width:100%; min-width:0; max-width:100%;
    line-height:1.45; resize:none;
  }
  body.rk-chat-keyboard-v107 .composer .send {flex:0 0 auto;}
  body.rk-chat-keyboard-v107 .thread-list {
    min-width:0; max-width:100%; overflow-y:auto;
    overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
  }
  body.rk-chat-keyboard-v107 .thread-info,
  body.rk-chat-keyboard-v107 .thread-name {min-width:0; max-width:100%;}
  body.rk-chat-keyboard-v107 .thread-name > span:first-child {
    min-width:0; text-overflow:ellipsis; white-space:nowrap; overflow:hidden;
  }
  body.rk-chat-keyboard-v107 .toast {max-width:calc(100% - 24px);}
  body.rk-chat-keyboard-v107 .active-conversation[hidden] {display:none!important;}
}
