/* Rabbit FIX P23 v12651 - smaller stickers + prevent horizontal overflow */
@media(max-width:800px){
  html{background:#FFC629!important;}
  body{background-color:var(--bg,#F6F5F1)!important;}
  body::before{
    content:"";
    position:fixed;
    left:0;right:0;top:0;
    height:max(env(safe-area-inset-top,0px),28px);
    background:#FFC629!important;
    z-index:999999;
    pointer-events:none;
  }
  .topbar.rabbit-topbar,.rabbit-topbar{
    background:rgba(255,250,232,.98)!important;
    color:#3b2b00!important;
    border-bottom-color:#e8cf83!important;
  }
}

/* Sticker picker: more contrast against white backgrounds */
.rabbit-sticker-picker button,
.chat-sticker-tray-v11800 button{
  background:#FFF6DA!important;
  border:1px solid #E5C96D!important;
  box-shadow:0 3px 10px rgba(91,70,19,.08)!important;
}
.rabbit-sticker-picker img{width:54px!important;height:54px!important;max-width:100%!important;object-fit:contain!important}
.rabbit-editor-sticker{width:50px!important;height:50px!important;max-width:100%!important;object-fit:contain!important;vertical-align:middle!important}
.rabbit-inline-sticker{width:78px!important;height:78px!important;max-width:100%!important;object-fit:contain!important;vertical-align:middle!important}
.rabbit-inline-sticker.mini{width:62px!important;height:62px!important}
.chat-sticker-tray-v11800 img{width:54px!important;height:54px!important;max-width:100%!important;object-fit:contain!important}

/* Real rich chat input: stickers render inside the typing area */
.rabbit-chat-hidden-body-v12650{display:none!important}
.rabbit-chat-rich-input-v12650{
  width:100%;
  min-height:60px;
  max-height:150px;
  overflow-y:auto;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  line-height:1.45;
  padding:10px 12px 18px!important;
  background:#fff!important;
  border:1px solid var(--border,#ECE8DC)!important;
  border-radius:14px!important;
  outline:none;
}
.rabbit-chat-rich-input-v12650:empty::before{content:attr(data-placeholder);color:#999184;pointer-events:none}
.rabbit-chat-rich-input-v12650:focus{border-color:#D9A900!important;box-shadow:0 0 0 3px rgba(255,198,41,.18)!important}
.rabbit-chat-editor-sticker-v12650{width:50px;height:50px;max-width:100%;object-fit:contain;vertical-align:middle;margin:2px 3px;user-select:none;-webkit-user-select:none}

/* Admin official chat rich input */
.support-hidden-body-v12650{display:none!important}
.support-rich-input-v12650{
  min-height:64px;
  max-height:150px;
  overflow-y:auto;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  line-height:1.45;
  padding:10px 12px!important;
  background:#fff!important;
  border:1px solid var(--line,#e8d59d)!important;
  border-radius:11px!important;
  outline:none;
}
.support-rich-input-v12650:empty::before{content:attr(data-placeholder);color:#9a907b;pointer-events:none}
.support-editor-sticker-v12650{width:50px;height:50px;max-width:100%;object-fit:contain;vertical-align:middle;margin:2px 3px;user-select:none;-webkit-user-select:none}
.support-rabbit-sticker img{width:76px!important;height:76px!important;max-width:100%!important;object-fit:contain!important}
.support-sticker-drawer img{width:52px!important;height:52px!important;max-width:100%!important;object-fit:contain!important}
.support-sticker-drawer button{background:#FFF6DA!important;border:1px solid #E5C96D!important}

@media(max-width:520px){
  .rabbit-sticker-picker img{width:44px!important;height:44px!important}
  .rabbit-editor-sticker{width:44px!important;height:44px!important}
  .rabbit-inline-sticker{width:68px!important;height:68px!important}
  .rabbit-inline-sticker.mini{width:54px!important;height:54px!important}
  .chat-sticker-tray-v11800 img{width:46px!important;height:46px!important}
  .rabbit-chat-rich-input-v12650{min-height:56px;max-height:135px;font-size:16px}
  .rabbit-chat-editor-sticker-v12650{width:44px;height:44px}
}


/* Keep sticker drawers/editors inside the viewport. */
.modal-bg,.modal,.compose-modal,.comment-panel-responsive,
#composeForm,#commentForm,.compose-sticker-drawer,.comment-sticker-drawer,
.rabbit-sticker-picker-wrap-v12620,.rabbit-sticker-picker,
.chat-sticker-tray-v11800,.rabbit-chat-rich-input-v12650,
.support-rich-input-v12650,.support-sticker-drawer{
  max-width:100%!important;
  min-width:0!important;
  box-sizing:border-box!important;
}
.rabbit-sticker-picker{
  width:100%!important;
  grid-template-columns:repeat(5,minmax(0,1fr))!important;
  overflow:hidden!important;
}
.rabbit-sticker-picker button,.chat-sticker-tray-v11800 button,.support-sticker-drawer button{
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
  padding:4px 2px!important;
}
.rabbit-rich-editor,.rabbit-chat-rich-input-v12650,.support-rich-input-v12650{
  overflow-x:hidden!important;
  word-break:break-word!important;
}
@media(max-width:520px){
  html,body{max-width:100vw!important;overflow-x:hidden!important;}
  .compose-modal,.comment-panel-responsive{width:min(100%,100vw)!important;}
  .support-editor-sticker-v12650{width:44px;height:44px}
  .support-rabbit-sticker img{width:66px!important;height:66px!important}
  .support-sticker-drawer img{width:46px!important;height:46px!important}
}

/* Rabbit FIX P24 v12652: stable chat tool row */
.chat-compose.chat-compose-fixed .chat-keyboard-toggle-v12652{grid-row:2;grid-column:3}
.chat-compose.chat-compose-fixed .chat-image-pick{grid-column:4!important}
.chat-compose.chat-compose-fixed .chat-send-btn{grid-column:6!important}
.chat-compose.chat-compose-fixed{grid-template-columns:auto auto auto auto minmax(0,1fr) auto!important}
@media(max-width:520px){.chat-compose.chat-compose-fixed{grid-template-columns:auto auto auto auto minmax(0,1fr) auto!important}}


/* Rabbit FIX P25 SAFE v12654: keep typing field visible without rewriting the chat viewport */
@media(max-width:800px){
  .rabbit-chat-fixed .chat-compose.chat-compose-fixed{
    position:sticky!important;
    bottom:0!important;
    z-index:50!important;
    flex:0 0 auto!important;
    background:#fff!important;
  }
  .rabbit-chat-fixed .text-limit-wrap{
    min-width:0!important;
    position:relative!important;
  }
  .rabbit-chat-rich-input-v12650{
    display:block!important;
    visibility:visible!important;
    opacity:1!important;
    min-height:50px!important;
    max-height:92px!important;
    overflow-y:auto!important;
    overflow-x:hidden!important;
    color:var(--text,#24231F)!important;
    caret-color:#24231F!important;
  }
  .rabbit-chat-rich-input-v12650:focus{
    scroll-margin-bottom:18px!important;
  }
}
