/* Only the launcher moves. The avatar keeps its original slide-out and speech bubble. */
body.competicions-app .avatar-helper__launcher {
  position: fixed;
  top: auto;
  right: auto;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  z-index: 1040;
  width: 48px;
  height: 48px;
  border-radius: 10px;
}

body.competicions-app .avatar-helper.is-open + .avatar-helper__launcher {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.competicions-app .avatar-helper {
  z-index: 1040;
}

body.competicions-app .avatar-helper__bubble {
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
}

body.competicions-app.has-competition-assistant {
  --avatar-launcher-clearance: 72px;
}

body.competicions-app.has-competition-assistant .competition-dock-wrap--immersive {
  --competition-dock-expanded-width: min(max(260px, calc(var(--competition-dock-item-count) * 105px + 18px)), calc(100vw - var(--avatar-launcher-clearance) - 12px));
  left: max(50%, calc(var(--avatar-launcher-clearance) + var(--competition-dock-expanded-width) / 2));
  min-width: 0;
  max-width: calc(100vw - var(--avatar-launcher-clearance) - 12px);
}

/* The existing QR menu remains next to the independent help button. */
body.jury-workspace-page.has-competition-assistant {
  --avatar-launcher-clearance: 124px;
}

body.jury-workspace-page.competicions-app.has-competition-assistant .platform-nav-rail {
  left: 68px;
  grid-template-columns: 36px;
}

@media (max-width: 767.98px) {
  body.competicions-app.has-competition-assistant .competition-dock-wrap:not(.competition-dock-wrap--immersive) {
    left: 72px;
    right: 12px;
    width: auto;
    max-width: calc(100vw - 84px);
    transform: none;
  }

  body.competicions-app.has-competition-assistant .competition-dock-toggle {
    min-width: 0;
    max-width: 100%;
  }

  body.competicions-app.has-competition-assistant .competition-dock-wrap--immersive {
    --competition-dock-expanded-width: min(460px, calc(100vw - 80px));
    left: auto;
    right: 12px;
    min-width: 0;
    max-width: calc(100vw - 80px);
    transform: none;
  }
}

@media (max-width: 720px) {
  /* Preserve the original mobile avatar geometry when the platform menu is present. */
  body.competicions-app.has-platform-navigation .avatar-helper {
    bottom: 94px;
    height: min(580px, calc(100dvh - 112px));
  }

  body.competicions-app.has-platform-navigation .avatar-helper__image {
    max-width: 160px;
    height: 260px;
  }

  body.competicions-app.has-platform-navigation .avatar-helper__bubble {
    top: 8px;
    left: 112px;
    box-sizing: border-box;
    width: calc(100vw - 128px);
    max-height: calc(100% - 16px);
    overflow-y: auto;
  }
}

@media (max-width: 600px) {
  body.jury-workspace-page.competicions-app.has-competition-assistant .competition-dock-wrap {
    left: 124px !important;
    max-width: calc(100vw - 132px) !important;
    --competition-dock-expanded-width: min(460px, calc(100vw - 132px));
  }
}
