/* Mobile placement for the existing Carrotquest and Complianz controls.
 * This layer creates no widget and does not change consent or chat loading.
 */
@media (max-width:1024px), (max-width:1366px) and (any-pointer:coarse){
  :root{
    --cg-floating-menu-clearance:var(--cg-nav-space,calc(80px + env(safe-area-inset-bottom,0px)));
    --cg-floating-chat-space:calc(80px + var(--cg-floating-gap));
    --cg-floating-gap:12px;
  }

  /* Carrotquest injects #id.position rules with !important after page load.
   * html:root makes this rule stronger for all four SDK position classes.
   */
  html:root #carrotquest-messenger-collapsed-container{
    position:fixed !important;
    top:auto !important;
    right:max(12px,env(safe-area-inset-right,0px)) !important;
    bottom:calc(var(--cg-floating-menu-clearance) + var(--cg-floating-gap)) !important;
    left:auto !important;
    width:80px !important;
    min-width:80px !important;
    max-width:80px !important;
    height:80px !important;
    margin:0 !important;
    transform:none !important;
    translate:none !important;
  }

  /* The SDK tooltip makes the 80px launcher a 251px click-blocking strip. */
  html:root #carrotquest-messenger-collapsed-container #tooltip-container,
  html:root #carrotquest-messenger-collapsed-container #carrot-messenger-tooltip{
    display:none !important;
  }

  /* Preserve the native Complianz button and click handler. The visual icon is
   * a 36px square edge tab inside a 44px accessible tap target. */
  html #cmplz-manage-consent .cmplz-manage-consent{
    position:fixed !important;
    top:auto !important;
    right:env(safe-area-inset-right,0px) !important;
    bottom:calc(var(--cg-floating-menu-clearance) + var(--cg-floating-gap) + var(--cg-floating-chat-space)) !important;
    left:auto !important;
    width:44px !important;
    min-width:44px !important;
    max-width:44px !important;
    height:44px !important;
    min-height:44px !important;
    max-height:44px !important;
    box-sizing:border-box !important;
    margin:0 !important;
    padding:0 !important;
    border:0 !important;
    border-radius:0 !important;
    background:transparent !important;
    box-shadow:none !important;
    color:transparent !important;
    font-size:0 !important;
    line-height:1 !important;
    overflow:visible !important;
  }

  html #cmplz-manage-consent .cmplz-manage-consent,
  html #cmplz-manage-consent .cmplz-manage-consent:hover,
  html #cmplz-manage-consent .cmplz-manage-consent:focus,
  html #cmplz-manage-consent .cmplz-manage-consent:active{
    animation:none !important;
    transition:none !important;
    transform:none !important;
    translate:none !important;
  }

  html #cmplz-manage-consent .cmplz-manage-consent::after{
    content:"";
    position:absolute;
    top:4px;
    right:0;
    width:36px;
    height:36px;
    box-sizing:border-box;
    border:1px solid rgba(255,255,255,.9);
    border-right:0;
    border-radius:9px 0 0 9px;
    background:#16265f;
    box-shadow:0 3px 10px rgba(22,38,95,.18);
    pointer-events:none;
  }

  html #cmplz-manage-consent .cmplz-manage-consent::before{
    content:"\2699\FE0E";
    position:absolute;
    z-index:1;
    top:4px;
    right:0;
    display:grid;
    place-items:center;
    width:36px;
    height:36px;
    color:#fff;
    font-size:20px;
    line-height:1;
    pointer-events:none;
  }

  html #cmplz-manage-consent .cmplz-manage-consent:focus-visible{
    outline:2px solid #16265f !important;
    outline-offset:2px;
  }

  /* Keep the consent panel above the site navigation and fully inside the
   * visible mobile viewport. */
  html:root .cmplz-cookiebanner{
    top:auto !important;
    right:12px !important;
    bottom:calc(var(--cg-floating-menu-clearance) + var(--cg-floating-gap)) !important;
    left:12px !important;
    width:auto !important;
    min-width:0 !important;
    transform:none !important;
    max-height:calc(100vh - var(--cg-floating-menu-clearance) - 36px - env(safe-area-inset-top,0px)) !important;
    max-height:calc(100dvh - var(--cg-floating-menu-clearance) - 36px - env(safe-area-inset-top,0px)) !important;
  }

  /* Floating launchers must not cover drawers, filter/sort panels, consent
   * actions, the on-screen keyboard or one another. */
  html.cg-preload-pending #carrotquest-messenger-collapsed-container,
  html.cg-preload-pending #cmplz-manage-consent .cmplz-manage-consent,
  html.cg-scroll-locked #carrotquest-messenger-collapsed-container,
  html.cg-scroll-locked #cmplz-manage-consent .cmplz-manage-consent,
  body.cg-msd-open #carrotquest-messenger-collapsed-container,
  body.cg-msd-open #cmplz-manage-consent .cmplz-manage-consent,
  body.cg-filters-open #carrotquest-messenger-collapsed-container,
  body.cg-filters-open #cmplz-manage-consent .cmplz-manage-consent,
  body.cg-sort-open #carrotquest-messenger-collapsed-container,
  body.cg-sort-open #cmplz-manage-consent .cmplz-manage-consent,
  html.cg-floating-consent-open #carrotquest-messenger-collapsed-container,
  html.cg-floating-consent-open #cmplz-manage-consent .cmplz-manage-consent,
  html.cg-floating-keyboard-open #carrotquest-messenger-collapsed-container,
  html.cg-floating-keyboard-open #cmplz-manage-consent .cmplz-manage-consent,
  html.cg-floating-chat-open #cmplz-manage-consent .cmplz-manage-consent{
    visibility:hidden !important;
    pointer-events:none !important;
  }

  html.cg-preload-pending #carrotquest-messenger-collapsed-container,
  html.cg-scroll-locked #carrotquest-messenger-collapsed-container,
  body.cg-msd-open #carrotquest-messenger-collapsed-container,
  body.cg-filters-open #carrotquest-messenger-collapsed-container,
  body.cg-sort-open #carrotquest-messenger-collapsed-container,
  html.cg-floating-consent-open #carrotquest-messenger-collapsed-container,
  html.cg-floating-keyboard-open #carrotquest-messenger-collapsed-container{
    opacity:0 !important;
  }
}
